NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class Inventory : MonoBehaviour
{
// Start is called before the first frame update
public int Price;
public string TypeofInventory;
public int InventoryCount;
public string InventoryASCII;
public bool isDefault;
public int isGetOrNot;
private int CoinCount;
public int PlusPower;
public float Radius;
private int CharacterCount;
private MenuSystem Manager;
private CharacterInfo Ch;
public int isManytime;
private float AverageCount;
private float RadiusCount;
[HideInInspector]
public TextMeshProUGUI AverageText;
[HideInInspector]
public TextMeshProUGUI RadiusText;

private string preAverage;
private string preRadius;
private CharacterInventory ChInv;
private TextMeshProUGUI PriceText;
[HideInInspector]
public TextMeshProUGUI NoCoinText;
private AudioManager AudioManagers;
public int SortInv;
void Awake()
{

isManytime = 0;
SetNullText();
Getisornt();
SetReset();
Settext();
}
void SetNullText()
{
AverageText.text = "";
RadiusText.text = "";
NoCoinText.text = "";
PriceText.text = "";
}
// Get Character Power-Radius And Print Text
void GetCharacterPower()
{


if (PlayerPrefs.GetInt("is" + TypeofInventory) == 1)
{

AverageCount = PlusPower - PlayerPrefs.GetFloat(TypeofInventory + "PrePower");
RadiusCount = Radius - Manager.Characters.GetComponent<RotateCharacter>().CharacterRadius;

}
else
{
AverageCount = PlusPower;
RadiusCount = Radius;
}
if (AverageCount > 0)
{
AverageText.color = Color.green;
preAverage = "+";
}

else
{
AverageText.color = Color.red;

}
if (RadiusCount > 0)
{
RadiusText.color = Color.green;
preRadius = "+";
}
else
{
RadiusText.color = Color.red;
}

if (PlayerPrefs.GetString("Language") == "English")
{
RadiusText.text = preRadius + RadiusCount;
AverageText.text = preAverage + AverageCount;

}
else
{
RadiusText.text = preRadius + RadiusCount;
AverageText.text = preAverage + AverageCount;
}

}
//İf previously get inventory,Use Inventory,if Not previously get inventory,Get Inventory
public void ChooseInventory()
{

if (PlayerPrefs.GetInt(TypeofInventory + InventoryCount + "Inventory") != 1)
{

PriceText.text = transform.GetComponent<Inventory>().Price.ToString();
GetCharacterPower();
Manager.InvType = TypeofInventory;
Manager.InvCount = InventoryCount;
Manager.PriceIn = Price;
Manager.InvSort = SortInv;
}
else
{

ResetSameInventory();
PlayerPrefs.SetInt(TypeofInventory + InventoryCount + "isUse", 1);
PlayerPrefs.SetString(TypeofInventory, InventoryASCII + InventoryCount);
AverageText.text = "";
PlayerPrefs.SetInt("is" + TypeofInventory, 1);
PlayerPrefs.SetFloat(TypeofInventory + "PrePower", PlusPower);
FindGetType();
SetReset();
if (PlayerPrefs.GetInt("Sound") == 0)
AudioManagers.GameSound[0].Play();
}
}
//Print Price Text
public void Settext()
{
for (int i = 0; i < Ch.Inventorys.Length; i++)
{
if (Ch.Inventorys[i].GetComponent<Inventory>().isGetOrNot != 1)
{

transform.Find("UseText").GetComponent<TextMeshProUGUI>().text = Price.ToString();


}






}

}
//Find Inventory Type for get Inventory
void FindGetType()
{

if (TypeofInventory == "FrontBumper")
ChInv = GameObject.Find("FrontBumper").GetComponent<CharacterInventory>();
else if (TypeofInventory == "RearBumper")
ChInv = GameObject.Find("RearBumper").GetComponent<CharacterInventory>();



ChInv.GetCharacterInventory();


}
//Every getting inventory to be first place
public void LetsSort()
{

if (TypeofInventory == "FrontBumper")
{

if (isGetOrNot == 1)
{
transform.SetSiblingIndex(2);
Ch.EnvScroll.value = 0;




}



}
else if (TypeofInventory == "RearBumper")
{

if (isGetOrNot == 1)
{
transform.SetSiblingIndex(7);
Ch.EnvScroll.value = 0.4f;


}



}

else if (TypeofInventory == "Body")
{

if (isGetOrNot == 1)
{
transform.SetSiblingIndex(7);
Ch.EnvScroll.value = 0.6f;



}



}
else if (TypeofInventory == "Platform")
{

if (isGetOrNot == 1)
{
transform.SetSiblingIndex(7);
Ch.EnvScroll.value = 0.6f;



}



}
else if (TypeofInventory == "Driver")
{

if (isGetOrNot == 1)
{
transform.SetSiblingIndex(7);
Ch.EnvScroll.value = 0.6f;



}



}
else if (TypeofInventory == "Rockets")
{

if (isGetOrNot == 1)
{
transform.SetSiblingIndex(7);
Ch.EnvScroll.value = 0.6f;



}



}

}
//Check is inventory get or not
public void Getisornt()
{
isGetOrNot = PlayerPrefs.GetInt(TypeofInventory + InventoryCount + "Inventory");
if (PlayerPrefs.GetInt(TypeofInventory + InventoryCount + "Inventory") == 1)
{
isGetOrNot = 1;
}
else
{
isGetOrNot = 0;
}

}

int x;
//Reset using İnventory Info
void ResetSameInventory()
{

if (TypeofInventory == "FrontBumper")
{
for (int i = 0; i < Ch.InventorysBuffer.Length; i++)
{




PlayerPrefs.SetInt(TypeofInventory + i + "isUse", 0);




}
}
else if (TypeofInventory == "RearBumper")
{

for (int i = 0; i < Ch.InventorysMirror.Length; i++)
{




PlayerPrefs.SetInt(TypeofInventory + i + "isUse", 0);




}

}
//Not Complete
else if (TypeofInventory == "Body")
{

for (int i = 0; i < Ch.InventorysMirror.Length; i++)
{




PlayerPrefs.SetInt(TypeofInventory + i + "isUse", 0);




}

}
else if (TypeofInventory == "Platform")
{

for (int i = 0; i < Ch.InventorysPlatform.Length; i++)
{




PlayerPrefs.SetInt(TypeofInventory + i + "isUse", 0);




}

}
else if (TypeofInventory == "Driver")
{

for (int i = 0; i < Ch.InventorysDriver.Length; i++)
{




PlayerPrefs.SetInt(TypeofInventory + i + "isUse", 0);




}

}
else if (TypeofInventory == "Rockets")
{

for (int i = 0; i < Ch.InventorysRockets.Length; i++)
{




PlayerPrefs.SetInt(TypeofInventory + i + "isUse", 0);




}

}





}
//Check is inventory use or not
public void SetReset()
{

for (int i = 0; i < Ch.Inventorys.Length; i++)
{

if (PlayerPrefs.GetInt(Ch.Inventorys[i].GetComponent<Inventory>().TypeofInventory + Ch.Inventorys[i].GetComponent<Inventory>().InventoryCount + "isUse") == 1)
{




Ch.Inventorys[i].GetComponent<Button>().interactable = false;
Ch.Inventorys[i].transform.Find("UseText").GetComponent<TextMeshProUGUI>().text = "";



}
else
{
Ch.Inventorys[i].GetComponent<Button>().interactable = true;
if ((Ch.Inventorys[i].GetComponent<Inventory>().isGetOrNot == 1))
{
Ch.Inventorys[i].transform.Find("UseText").GetComponent<TextMeshProUGUI>().text = "KULLAN";

}

}



}


}

}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.