private void Awake() { for (int i = 0; i < apearsPos.Length; i++) { apearsPos[i].parent.transform.gameObject.SetActive(true); } levelScene += 3; player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController2>(); plAttack = player.gameObject.GetComponent <PlayerAttack>(); inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory2>(); pauseManager = GameObject.FindGameObjectWithTag("PauseManager").GetComponent <PauseManager>(); //Carga la player Info LoadPlayer(); if (ScenesManager.scenesManager.comeFromDead) { inventory.actualMoney = inventory.actualMoney / 2; ScenesManager.scenesManager.comeFromDead = false; } //POSICIONA AL PLAYER PlayerPosition(); }
//public int Gems; // Start is called before the first frame update void Start() { inventory = GameObject.FindGameObjectWithTag("Red").GetComponent <Inventory>(); inventory2 = GameObject.FindGameObjectWithTag("Yellow").GetComponent <Inventory2>(); //add inventory2 for player yellow Instance = this; }
// Start is called before the first frame update void Start() { inventory = GameObject.FindGameObjectWithTag("Red").GetComponent <Inventory>(); inventory2 = GameObject.FindGameObjectWithTag("Yellow").GetComponent <Inventory2>(); RGet = 0; YGet = 0; //coget = 0; }
InventorySlot2[] slots; // List of all the slots void Start() { inventory = Inventory2.instance; //inventory.onItemChangedCallback += UpdateUI; // Subscribe to the onItemChanged callback // Populate our slots array slots = itemsParent.GetComponentsInChildren <InventorySlot2>(); //UpdateUI(); }
private void Start() { anim = GetComponent <Animator>(); currentHealth = maxHealth; healthBar.maxValue = maxHealth; healthBar.value = currentHealth; inventory = Inventory2.inventory; player = FindObjectOfType <PlayerHealth>(); }
void Awake() { if (instance != null) { Debug.LogWarning("More than one instance of Inventory found!"); return; } instance = this; }
public static UI_Manager UI; //UI管理 void Awake() { inventory = GameObject.Find("Inventory").GetComponent <Inventory2> (); equip = GameObject.Find("Equipment").GetComponent <Equip_Manager>(); store = GameObject.Find("store").GetComponent <Store>(); key = GameObject.Find("short cut/Key").GetComponent <Key> (); skillUI = GameObject.Find("skill_UI").GetComponent <Skill_UI> (); money = GameObject.Find("inventory/Win/money").GetComponent <Money> (); UI = GameObject.Find("UI Root").GetComponent <UI_Manager> (); }
//GUARDAR LOS DATOS DEL PLAYER public static void SavePlayerData(PlayerController2 player, Inventory2 inventory, PlayerAttack plAttack) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/playerdata.info"; FileStream stream = new FileStream(path, FileMode.Create); PlayerData data = new PlayerData(player, inventory, plAttack); formatter.Serialize(stream, data); stream.Close(); }
//------------------- //------------------- private void Awake() { if (inventory == null) { inventory = this; } else if (inventory != this) { Destroy(gameObject); } itemDescription = ItemType.Nothing; }
// Start is called before the first frame update void Start() { Instance = this; index = 0; //items yGems = 0; yBadKey = 0; yGoodKey = 0; yFeathers = 0; yFood = 0; yGums = 0; yRopes = 0; }
public void CombineInventorySlotsFromDifferentInventories() { var mints1 = GetWaferThinMint(); mints1.SetCount(8); mints1 = Inventory.SetItem(12, mints1); var mints2 = GetWaferThinMint(); mints2.SetCount(8); mints2 = Inventory2.SetItem(12, mints2); Inventory.CombineStacks(mints1, mints2); Assert.That(Inventory[12].GetCount(), Is.EqualTo(10), "Destination stack"); Assert.That(Inventory2[12].GetCount(), Is.EqualTo(6), "Source stack"); }
// Use this for initialization void Start() { database = GameObject.Find("Inventory").GetComponent <ItemDatabase>(); inventory2 = GameObject.Find("Inventory_trading").GetComponent <Inventory2>(); pl = GameObject.FindGameObjectWithTag("Player").GetComponent <player_interaction>(); co = GameObject.FindGameObjectWithTag("Player").GetComponent <ClassQuest>(); prsnt = prsn.GetComponent <Text>(); prsn_anst = prsn_ans.GetComponent <Text>(); ans1.onClick.AddListener(ans1OnClick); ans2.onClick.AddListener(ans2OnClick); trd.onClick.AddListener(trdOnClick); ext.onClick.AddListener(extOnClick); if (Nr_Smth == true) { prsnt.text = "Кузнец"; id = 0; } }
public PlayerData(PlayerController2 plController2, Inventory2 inventory2, PlayerAttack playerAttack) { health = plController2.health; maxHealth = plController2.maxHealth; potions = plController2.potions; maxPotions = plController2.maxPotions; lastScene = plController2.lastScene; money = inventory2.actualMoney; bombs = inventory2.nBombs; telePorts = inventory2.nTP; haveSword = playerAttack.haveSword; dashUnlocked = plController2.dashUnlocked; highJumpUnlocked = plController2.dobleJumpUnlocked; wallJumpUnlocked = plController2.wallJumpUnlocked; waterPasive = inventory2.waterPasive; swordPasive = inventory2.swordPasive; }
private void Start() { image = GetComponent <Image>(); button = GetComponent <Button>(); if (ScenesManager.scenesManager.FountainUnlocked[iconNumber]) { image.enabled = true; button.enabled = true; } else { image.enabled = false; button.enabled = false; } player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController2>(); inventory = player.GetComponentInChildren <Inventory2>(); sceneToLoad += 3; }
public void OnCollisionEnter2D(Collision2D collision) { if (collision.transform.CompareTag("Player")) { picked = true; Collider2D col = GetComponent <Collider2D>(); col.enabled = false; GFX.enabled = false; Inventory2 inventory = collision.transform.GetComponentInChildren <Inventory2>(); inventory.WinMoney(moneyToAdd); sound.Play(); addingPickUp.PrintPickUpInfo(GFX.sprite, moneyToAdd); } else if (collision.transform.CompareTag("Pinchos")) { touchPinchos = true; } }
void Awake() { pauseManager = GameObject.FindGameObjectWithTag("PauseManager").GetComponent <PauseManager>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController2>(); inventory = player.GetComponentInChildren <Inventory2>(); plAttack = player.gameObject.GetComponent <PlayerAttack>(); blackFade.SetActive(false); settingsPanel.SetActive(false); rightOptions.SetActive(false); exitGameQuest.SetActive(false); goToMainMenuQuest.SetActive(false); bookContainer.SetActive(false); mapPanel.SetActive(false); masterSlider.value = PlayerPrefs.GetFloat(masterVolume, 0); musicSlider.value = PlayerPrefs.GetFloat(musicVolume, 0); fxSlider.value = PlayerPrefs.GetFloat(fxVolume, 0); onAwake = false; }
//[SerializeField] AudioClip craftingBGM; private void Start() { inventory = GetComponent <Inventory>(); if (object1) { object1.transform.SetAsLastSibling(); } if (object2) { object2.transform.SetAsLastSibling(); } if (object3) { object3.transform.SetAsLastSibling(); } if (object4) { object4.transform.SetAsLastSibling(); } inventory2 = GetComponent <Inventory2>(); if (product1) { product1.transform.SetAsLastSibling(); } if (product2) { product2.transform.SetAsLastSibling(); } if (product3) { product3.transform.SetAsLastSibling(); } if (product4) { product4.transform.SetAsLastSibling(); } if (product5) { product5.transform.SetAsLastSibling(); } if (product6) { product6.transform.SetAsLastSibling(); } if (product7) { product7.transform.SetAsLastSibling(); } if (crafting) { crafting.transform.SetAsLastSibling(); } if (craftbutton) { craftbutton.transform.SetAsLastSibling(); } if (product11) { product11.transform.SetAsLastSibling(); } if (product21) { product21.transform.SetAsLastSibling(); } if (product31) { product31.transform.SetAsLastSibling(); } if (product41) { product41.transform.SetAsLastSibling(); } if (product51) { product51.transform.SetAsLastSibling(); } if (product61) { product61.transform.SetAsLastSibling(); } if (product71) { product71.transform.SetAsLastSibling(); } inventoryC = GetComponent <InventoryC>(); EnableCrafting(false); restartbutton.SetActive(false); winner.enabled = false; score.enabled = false; }
public static bool ShowToolTipPatch(Inventory2 __instance, item Item, int money, int moneyPercent) { Inventory2 _this = __instance; JSONObject jsonobject = jsonData.instance.ItemJsonData[Item.itemID.ToString()]; string a = Tools.Code64(jsonobject["name"].ToString()); TooltipItem component = _this.Tooltip.GetComponent <TooltipItem>(); component.Clear(); string text = Tools.instance.Code64ToString(Inventory2.getSkillBookDesc(jsonobject)); //武器 if ((int)jsonobject["type"].n == 0) { try { if (!jsonData.instance.EquipSeidJsonData[2].HasField(Item.itemID.ToString())) { Debug.LogError($"[MCSDataHelper]id为{Item.itemID}的物品未填写装备seid,请参考d_items.py.equip_seid2进行填写"); } int num = (int)jsonData.instance.EquipSeidJsonData[2][Item.itemID.ToString()]["value1"].n; JSONObject jsonobject2 = jsonData.instance.skillJsonData[num.ToString()]; int itemCD = Inventory2.GetItemCD(Item); component.Label7.text = itemCD + "回合"; string text2 = ""; foreach (JSONObject jsonobject3 in Inventory2.GetItemAttackType(Item.Seid, jsonobject2["AttackType"]).list) { text2 += Tools.getStr("xibieFight" + (int)jsonobject3.n); } component.Label8.text = text2; component.setCenterTextTitle("【冷却】", "【属性】", ""); text = "[f28125]【主动】[-] [E0DDB4]" + text.Replace("主动:", ""); Traverse.Create(_this).Field("showToolType").SetValue(1); } catch (Exception message) { TooltipItem component2 = _this.Tooltip.GetComponent <TooltipItem>(); component2.Clear(); component2.Label2.text = $"[bfba7d]武器 物品出错{Item.itemID}[-]"; Debug.LogWarning($"武器 物品出错{Item.itemID}"); Debug.LogWarning(message); } } //TODO 功法书和杂道书 else if ((int)jsonobject["type"].n == 4 || (int)jsonobject["type"].n == 13) { try { int studiSkillTime = Tools.getStudiSkillTime((int)jsonobject["StuTime"].n, jsonobject["wuDao"]); string str = Tools.getStr("xiaohaoshijian").Replace("{Y}", string.Concat(Tools.DayToYear(studiSkillTime))).Replace("{M}", string.Concat(Tools.DayToMonth(studiSkillTime))).Replace("{D}", string.Concat(Tools.DayToDay(studiSkillTime))).Replace("消耗时间:", ""); string text3 = ""; foreach (object obj in component.TooltipHelp.transform.parent) { Transform transform = (Transform)obj; if (transform.gameObject.activeSelf) { UnityEngine.Object.Destroy(transform.gameObject); } } text3 = text3 + "[d3b068]领悟时间:[-][E0DDB4]" + str + "[-]\n"; List <int> wudaoTypeList = new List <int>(); List <int> wudaoLvList = new List <int>(); item.GetWuDaoType(Item.itemID, wudaoTypeList, wudaoLvList); string str2 = item.StudyTiaoJian(wudaoTypeList, wudaoLvList); text3 = text3 + "[d3b068]领悟条件:[-][E0DDB4]" + str2 + "[-]\n"; string str3 = item.StudyTiSheng(wudaoTypeList, "领悟后能够提升对"); text3 = text3 + "[d3b068]悟道提升[-][E0DDB4]" + str3 + "[-]"; if ((int)jsonobject["type"].n == 13) { int jsonobject4 = Tools.getJsonobject(Tools.instance.getPlayer().NaiYaoXin, Item.itemID.ToString() ?? ""); text3 = string.Concat(new object[] { text3, "\n[d3b068]领悟次数[-][E0DDB4]", jsonobject4, "/", (int)jsonobject["CanUse"].n, "[-]" }); } component.ShowSkillTime(text3); Traverse.Create(_this).Field("showToolType").SetValue(2); } catch (Exception message) { TooltipItem component2 = _this.Tooltip.GetComponent <TooltipItem>(); component2.Clear(); component2.Label2.text = "[bfba7d]暂无说明[-]"; Debug.LogWarning("2 Mod物品出错" + Item.itemID.ToString()); Debug.LogWarning(message); } } //TODO 技能书 else if ((int)jsonobject["type"].n == 3 && a != "情报玉简") { try { string text4 = ""; int studiSkillTime2 = Tools.getStudiSkillTime((int)jsonobject["StuTime"].n, jsonobject["wuDao"]); string str4 = Tools.getStr("xiaohaoshijian").Replace("{Y}", string.Concat(Tools.DayToYear(studiSkillTime2))).Replace("{M}", string.Concat(Tools.DayToMonth(studiSkillTime2))).Replace("{D}", string.Concat(Tools.DayToDay(studiSkillTime2))).Replace("消耗时间:", ""); text4 = text4 + "[d3b068]领悟时间:[-][E0DDB4]" + str4 + "[-]\n"; List <int> wudaoTypeList2 = new List <int>(); List <int> wudaoLvList2 = new List <int>(); item.GetWuDaoType(Item.itemID, wudaoTypeList2, wudaoLvList2); string str5 = item.StudyTiaoJian(wudaoTypeList2, wudaoLvList2); text4 = text4 + "[d3b068]领悟条件:[-][E0DDB4]" + str5 + "[-]\n"; string str6 = item.StudyTiSheng(wudaoTypeList2, "领悟后能够提升对"); text4 = text4 + "[d3b068]悟道提升[-][E0DDB4]" + str6 + "[-]"; component.ShowSkillTime(text4); TooltipItem tooltipItem = component; int num2 = (int)float.Parse(jsonobject["desc"].str); JSONObject jsonobject5 = new JSONObject(); foreach (KeyValuePair <string, JSONObject> keyValuePair in jsonData.instance.skillJsonData) { if ((int)keyValuePair.Value["Skill_ID"].n == num2 && (int)keyValuePair.Value["Skill_Lv"].n == Tools.instance.getPlayer().getLevelType()) { jsonobject5 = keyValuePair.Value; break; } } foreach (object obj2 in component.LingQiGride.transform) { Transform transform2 = (Transform)obj2; if (transform2.gameObject.activeSelf) { UnityEngine.Object.Destroy(transform2.gameObject); } } int num3 = 0; foreach (JSONObject jsonobject6 in jsonobject5["skill_CastType"].list) { if (num3 > 0) { _this.CreatGameObjectToParent(tooltipItem.LingQiGride, tooltipItem.LingQifengexianImage); } for (int i = 0; i < (int)jsonobject5["skill_Cast"][num3].n; i++) { _this.CreatGameObjectToParent(tooltipItem.LingQiGride, tooltipItem.lingqiGridImage).GetComponent <Image>().sprite = tooltipItem.lingQiGrid[(int)jsonobject6.n]; } num3++; } int num4 = 0; foreach (JSONObject jsonobject7 in jsonobject5["skill_SameCastNum"].list) { if (num3 > 0 || num4 > 0) { _this.CreatGameObjectToParent(tooltipItem.LingQiGride, tooltipItem.LingQifengexianImage); } for (int j = 0; j < (int)jsonobject7.n; j++) { _this.CreatGameObjectToParent(tooltipItem.LingQiGride, tooltipItem.lingqiGridImage).GetComponent <Image>().sprite = tooltipItem.lingQiGrid[tooltipItem.lingQiGrid.Count - 1]; } num4++; } component.ShowSkillGride(); Traverse.Create(_this).Field("showToolType").SetValue(3); } catch (Exception message) { TooltipItem component2 = _this.Tooltip.GetComponent <TooltipItem>(); component2.Clear(); component2.Label2.text = "[bfba7d]暂无说明[-]"; Debug.LogWarning("3 Mod物品出错" + Item.itemID.ToString()); Debug.LogWarning(message); } } //TODO 药材 else if ((int)jsonobject["type"].n == 6) { try { KBEngine.Avatar player = Tools.instance.getPlayer(); string liDanLeiXinStr = Tools.getLiDanLeiXinStr((int)jsonobject["yaoZhi2"].n); string liDanLeiXinStr2 = Tools.getLiDanLeiXinStr((int)jsonobject["yaoZhi3"].n); string liDanLeiXinStr3 = Tools.getLiDanLeiXinStr((int)jsonobject["yaoZhi1"].n); component.Label7.text = (player.GetHasZhuYaoShuXin(Item.itemID, jsonobject["quality"].I) ? liDanLeiXinStr : "未知"); component.Label8.text = (player.GetHasFuYaoShuXin(Item.itemID, jsonobject["quality"].I) ? liDanLeiXinStr2 : "未知"); component.Label9.text = (player.GetHasYaoYinShuXin(Item.itemID, jsonobject["quality"].I) ? liDanLeiXinStr3 : "未知"); component.setCenterTextTitle("【主药】", "【辅药】", "【药引】"); Traverse.Create(_this).Field("showToolType").SetValue(6); } catch (Exception message) { TooltipItem component2 = _this.Tooltip.GetComponent <TooltipItem>(); component2.Clear(); component2.Label2.text = "[bfba7d]暂无说明[-]"; Debug.LogWarning("4 Mod物品出错" + Item.itemID.ToString()); Debug.LogWarning(message); } } //TODO 丹炉和灵舟 else if ((int)jsonobject["type"].n == 9 || (int)jsonobject["type"].n == 14) { try { if (!Item.Seid.HasField("NaiJiu")) { Item.Seid = Tools.CreateItemSeid(Item.itemID); } component.setCenterTextTitle("【耐久】", "", ""); int num5 = (int)Item.Seid["NaiJiu"].n; int num6 = 100; if ((int)jsonobject["type"].n == 14) { num6 = (int)jsonData.instance.LingZhouPinJie[jsonobject["quality"].I.ToString()]["Naijiu"]; } component.Label7.text = num5 + "/" + num6; Traverse.Create(_this).Field("showToolType").SetValue(9); } catch (Exception message) { TooltipItem component2 = _this.Tooltip.GetComponent <TooltipItem>(); component2.Clear(); component2.Label2.text = "[bfba7d]暂无说明[-]"; Debug.LogWarning("5 Mod物品出错" + Item.itemID.ToString()); Debug.LogWarning(message); } } //TODO 丹药 else if ((int)jsonobject["type"].n == 5) { try { component.setCenterTextTitle("【耐药】", "【丹毒】", ""); component.Label8.text = string.Concat((int)jsonobject["DanDu"].n); int jsonobject8 = Tools.getJsonobject(Tools.instance.getPlayer().NaiYaoXin, Item.itemID.ToString() ?? ""); int itemCanUseNum = item.GetItemCanUseNum(jsonobject["id"].I); component.Label7.text = jsonobject8 + "/" + itemCanUseNum; component.ShowPlayerInfo(); Traverse.Create(_this).Field("showToolType").SetValue(5); } catch (Exception message) { TooltipItem component2 = _this.Tooltip.GetComponent <TooltipItem>(); component2.Clear(); component2.Label2.text = "[bfba7d]暂无说明[-]"; Debug.LogWarning("6 Mod物品出错" + Item.itemID.ToString()); Debug.LogWarning(message); } } else { Traverse.Create(_this).Field("showToolType").SetValue(0); } Regex regex = new Regex("\\{STVar=\\d*\\}"); MatchCollection matchCollection = Regex.Matches(text, "\\{STVar=\\d*\\}"); foreach (var m in matchCollection) { int num7; if (int.TryParse(((Match)m).Value.Replace("{STVar=", "").Replace("}", ""), out num7)) { int num8 = (int)Tools.instance.getPlayer().StaticValue.Value[num7]; text = regex.Replace(text, num8.ToString()); } } Regex.Matches(text, "【\\w*】"); foreach (object obj3 in matchCollection) { Match match = (Match)obj3; text = text.Replace(match.Value, "[42E395]" + match.Value + "[-]"); } component.Label1.text = "[e0ddb4]" + Inventory2.GetItemFirstDesc(Item.Seid, text); component.Label2.text = "[bfba7d]" + Inventory2.GetItemDesc(Item.Seid, Tools.instance.Code64ToString(jsonobject["desc2"].str)); int num9 = Inventory2.GetItemQuality(Item, (int)jsonobject["quality"].n); List <string> tootipItemQualityColor = jsonData.instance.TootipItemQualityColor; string newValue = tootipItemQualityColor[num9 - 1] + Tools.getStr("shuzi" + num9) + Tools.getStr("jiecailiao"); if ((int)jsonobject["type"].n == 0 || (int)jsonobject["type"].n == 1 || (int)jsonobject["type"].n == 2) { num9++; if (Item.Seid != null && Item.Seid.HasField("qualitydesc")) { newValue = tootipItemQualityColor[num9 - 1] + Item.Seid["qualitydesc"].str; } else { int num10 = (Item.Seid != null && Item.Seid.HasField("QPingZhi")) ? Item.Seid["QPingZhi"].I : ((int)jsonobject["typePinJie"].n); newValue = tootipItemQualityColor[num9 - 1] + Tools.getStr("EquipPingji" + (num9 - 1)) + ((num10 > 0) ? Tools.getStr("shangzhongxia" + num10) : ""); } } else if ((int)jsonobject["type"].n == 3 || (int)jsonobject["type"].n == 4) { num9 *= 2; newValue = tootipItemQualityColor[num9 - 1] + Tools.getStr("pingjie" + (int)jsonobject["quality"].n) + Tools.getStr("shangzhongxia" + (int)jsonobject["typePinJie"].n); } else if ((int)jsonobject["type"].n == 5 || (int)jsonobject["type"].n == 9) { newValue = tootipItemQualityColor[num9 - 1] + Tools.getStr("shuzi" + num9) + Tools.getStr("pingdianyao"); } else if ((int)jsonobject["type"].n == 6 || (int)jsonobject["type"].n == 7 || (int)jsonobject["type"].n == 8) { newValue = tootipItemQualityColor[num9 - 1] + Tools.getStr("shuzi" + num9) + Tools.getStr("jiecailiao"); if ((int)jsonobject["type"].n == 8) { int i2 = jsonobject["WuWeiType"].I; string text5; if (i2 == 0) { text5 = "无"; } else { text5 = Tools.Code64(jsonData.instance.LianQiWuWeiBiao[i2.ToString()]["desc"].str); } component.Label7.text = text5; int i3 = jsonobject["ShuXingType"].I; string text6; if (i3 == 0) { text6 = "无"; } else { text6 = Tools.Code64(jsonData.instance.LianQiShuXinLeiBie[i3.ToString()]["desc"].str); } component.Label8.text = text6; component.setCenterTextTitle("【种类】", "【属性】", ""); } } component.Label3.text = Tools.getStr("pingjieCell").Replace("{X}", newValue).Replace("[333333]品级:", ""); component.Label4.text = ((jsonData.instance.TootipItemNameColor[num9 - 1] + Inventory2.GetItemName(Item, Tools.instance.Code64ToString(jsonobject["name"].str))) ?? ""); component.Label5.text = Tools.getStr("ItemType" + (int)jsonobject["type"].n); if (money != 0) { int num11 = money; if (Item.Seid != null && Item.Seid.HasField("NaiJiu")) { num11 = (int)((float)num11 * ItemCellEX.getItemNaiJiuPrice(Item)); } component.Label6.transform.parent.gameObject.SetActive(true); component.Label6.text = string.Concat(num11); if (moneyPercent > 0) { component.Label6.text = ((Tools.getStr("ItemColor" + 6) + num11) ?? ""); } component.ShowMoney(); } else { component.Label6.transform.parent.gameObject.SetActive(false); } component.icon.mainTexture = Item.itemIcon; component.pingZhi.mainTexture = Item.itemPingZhi; return(false); }
void Start() { inv = GameObject.Find("Inventory_trading").GetComponent <Inventory2> (); }
private void Start() { inventory2 = GameObject.FindGameObjectWithTag("Player").GetComponent <Inventory2>(); }
partial void DeleteInventory2(Inventory2 instance);
partial void UpdateInventory2(Inventory2 instance);
partial void InsertInventory2(Inventory2 instance);