void RefreshUI() { uint mineStoneID = homeDM.StoneID; ItemDataBase db = GameTableManager.Instance.GetTableItem <ItemDataBase>(mineStoneID); if (db != null) { m_label_Mine_Name.text = db.itemName; m_label_all_income.text = (homeDM.GainStoneNum * factor).ToString(); MineDataBase mdb = GameTableManager.Instance.GetTableItem <MineDataBase>(mineStoneID); if (mdb != null) { uint gainTime = mdb.mineGainTime * (uint)factor; m_label_reward_time.text = StringUtil.GetStringBySeconds(gainTime); ItemDataBase compassData = GameTableManager.Instance.GetTableItem <ItemDataBase>(homeDM.ComPassID); if (compassData != null) { m_label_name.text = compassData.itemName; string spriteName = string.IsNullOrEmpty(compassData.itemIcon) ? ItemDefine.ICON_NULL : compassData.itemIcon; UIManager.GetTextureAsyn(spriteName, ref m_CASD, () => { if (null != m__icon) { m__icon.mainTexture = null; } }, m__icon); int count = DataManager.Manager <ItemManager>().GetItemNumByBaseId(homeDM.ComPassID); int needLuoPan = GameTableManager.Instance.GetGlobalConfig <int>("MineDig", factor.ToString()); m_label_num.text = StringUtil.GetNumNeedString(count, needLuoPan); } } } }
public static void Open(ItemDataBase Content) { ItemEditorWindow window = GetWindow <ItemEditorWindow>("Item Editor"); window.my = Content; window.SetStyle(); }
void Start() { /* * if (!isLocalPlayer) * return; */ rigid = GetComponent <Rigidbody> (); anim = transform.Find("playerobj").GetComponent <Animator> (); m_camera = GameObject.Find("Main Camera").GetComponent <Camera> (); direction = transform.forward * 0.1f; //速度ベクトル Running = false; JumpTime = 1f; ItemDataBase DataBaseSC = GameObject.Find("MyDataBase").GetComponent <ItemDataBase> (); ItemList = DataBaseSC.getItemData(); AccessoryList = DataBaseSC.getAccessoryData(); WeaponList = DataBaseSC.getWeaponData(); DressList = DataBaseSC.getDressData(); latest_pos = transform.position; }
public void SharkKilled() { int xp = 1500; if (GameSetup.IsMultiplayer) { using (System.IO.MemoryStream answerStream = new System.IO.MemoryStream()) { using (System.IO.BinaryWriter w = new System.IO.BinaryWriter(answerStream)) { w.Write(10); w.Write((long)xp); } Network.NetworkManager.SendLine(answerStream.ToArray(), Network.NetworkManager.Target.Everyone); } } else { ModdedPlayer.instance.AddKillExperience(xp); } if (!GameSetup.IsMpClient) { Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(270), LocalPlayer.Transform.position + Vector3.up * 6f, ItemPickUp.DropSource.EnemyOnDeath); Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(310), LocalPlayer.Transform.position + Vector3.up * 6f, ItemPickUp.DropSource.EnemyOnDeath); Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(370), LocalPlayer.Transform.position + Vector3.up * 6f, ItemPickUp.DropSource.EnemyOnDeath); } }
public void AddItem(string itemName) { ItemDataBase idb = FindObjectOfType <InventoryMenu>().allItems; int counter = 0; foreach (ItemData id in idb.allItems) { if (id.inkTag == itemName) { foreach (ItemData idp in playerItems) { if (idp.inkTag == itemName) { counter++; } } if (counter < id.max) { playerItems.Add(id); print("Added Item: " + id.inkTag); FindObjectOfType <NewItemPanel>().Show(id); } counter = 0; } } }
void CreateDataBase(){ _items = ScriptableObject.CreateInstance<ItemDataBase>(); AssetDatabase.CreateAsset (_items, "Assets/Resources/ItemDataBase.asset"); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
// Start is called before the first frame update void Start() { message_set = MessageSetScript.message_set; enemymoving = EnemySetfightSceneMoving.enemyset; EnemyObjectSet(enemymoving.objes); set = enemy_parameter_set.set; player = playerStatus.player_status; player.GetComponent <player_colider>().enabled = false; player.GetComponent <playerMoveController>().enabled = false; button.Select(); item_base = ItemDataBase.item_base; ItemGetScript = ItemImageGetScript.item_image_script; foreach (ItemList item in item_base.items) { GameObject g = Instantiate(ItemIcon, Center_objes.transform.position, Quaternion.identity, Center_objes.transform); if (item.image != null) { //g.GetComponent<Image>().sprite = Sprite.Create(item.itemIcon, new Rect(0, 0, item.itemIcon.width, item.itemIcon.height), Vector2.zero); g.GetComponent <Image>().sprite = item.image; } g.GetComponent <ItemIconClickScript>().item = item; } message_set.MessageSet("敵が#{enemy_count}体現れた!"); //foreach() }
public void onclick() { ItemDataBase DataBase = GameObject.Find("MyDataBase").GetComponent <ItemDataBase> (); switch (itemType) { case Item.ItemType.Item: break; case Item.ItemType.Accessory: DataBase.SetPlayerAccessory(itemID); break; case Item.ItemType.Dress: DataBase.SetPlayerDress(itemID); break; case Item.ItemType.Weapon: DataBase.SetPlayerWeapon(itemID); break; default: break; } }
public override void SetGridData(object data) { base.SetGridData(data); if (data == null) { itemLogData = null; return; } itemLogData = data as ItemTradeLog; ItemDataBase baseData = GameTableManager.Instance.GetTableItem <ItemDataBase>(itemLogData.item_base_id); if (baseData != null) { UIManager.GetTextureAsyn(baseData.itemIcon, ref m_iconCASD, () => { if (null != itemIcon) { itemIcon.mainTexture = null; } }, itemIcon); itemName.text = baseData.itemName; itemNum.text = itemLogData.item_num.ToString(); uint saleMoney = 0; string iconName = ""; if (itemLogData.gold > 0) { CurrencyIconData Currdata = CurrencyIconData.GetCurrencyIconByMoneyType(ClientMoneyType.YinLiang); iconName = Currdata.smallIconName; saleMoney = itemLogData.gold; } else if (itemLogData.coin > 0) { CurrencyIconData Currdata = CurrencyIconData.GetCurrencyIconByMoneyType(ClientMoneyType.YuanBao); saleMoney = itemLogData.coin; iconName = Currdata.smallIconName; } UIManager.GetAtlasAsyn(iconName, ref m_huobi1CASD, () => { if (null != HuoBiIcon1) { HuoBiIcon1.atlas = null; } }, HuoBiIcon1); UIManager.GetAtlasAsyn(iconName, ref m_huobi2CASD, () => { if (null != HuoBiIcon2) { HuoBiIcon2.atlas = null; } }, HuoBiIcon2); itemPrice.text = (saleMoney / itemLogData.item_num).ToString(); totalPrice.text = saleMoney.ToString(); remainTime.text = StringUtil.GetStringSince1970(itemLogData.sell_time); } }
bool CheckItem() { SkillDatabase db = GameTableManager.Instance.GetTableItem <SkillDatabase>((uint)m_skillid, 1); if (db == null) { return(false); } string needstr = db.skillPlayCostItem; string[] itemArray = needstr.Split('_'); if (itemArray.Length > 1) { uint itemID = 0, itemCount = 0; if (uint.TryParse(itemArray[0], out itemID)) { if (uint.TryParse(itemArray[1], out itemCount)) { int count = DataManager.Manager <ItemManager>().GetItemNumByBaseId(itemID); if (count < itemCount) { ItemDataBase idb = GameTableManager.Instance.GetTableItem <ItemDataBase>(itemID); if (idb != null) { TipsManager.Instance.ShowTips(idb.itemName + CommonData.GetLocalString("不足")); } return(false); } } } } return(true); }
public void SetGridInfo(string ItemID, uint needNum = 1) { m_needNum = needNum; UIKnightLevelUPItemGrid grid = this; uint id = 0; if (uint.TryParse(ItemID, out id)) { ItemDataBase db = GameTableManager.Instance.GetTableItem <ItemDataBase>(id); if (db != null) { grid.Init(); grid.SetIcon(true, db.itemIcon); int num = DataManager.Manager <ItemManager>().GetItemNumByBaseId(id); string numstr = StringUtil.GetNumNeedString(num, needNum); grid.SetNum(true, numstr); string name = ItemDefine.GetItemBorderIcon(db.quality); grid.SetBorder(true, name); grid.ItemID = id; grid.ItemNum = (uint)num; grid.RegisterUIEventDelegate(UIItemInfoEventDelegate); //获取途径 if (num < needNum) { grid.SetNotEnoughGet(true); } else { grid.SetNotEnoughGet(false); } } } }
public void Awake() { owner = this.transform.parent.parent.parent.gameObject;//VERY CAREFULL may break if not set right allItem = GameObject.Find("AllItems").GetComponent <ItemDataBase>(); print(owner); for (int i = 0; i < 16; i++) { var UI = Instantiate(slot_UI);//make new game object from prefab UI.transform.SetParent (owner.GetComponentInChildren <Canvas>().gameObject.transform.Find("Invenotrty_with_all_buttons/Invenotry_Background")); //sets parent ot be inv_bckgrnd UI.transform.GetChild(0).GetComponent <Slot_Item>().item = new Item(); //sets item to empyt item UI.transform.GetChild(0).GetComponent <Slot_Item>().item.Parent = UI; UI.transform.GetChild(0).GetComponent <Image>().sprite = new Item().Sprite; //setting Sprite var text = Instantiate(slot_Text); //creating text text.transform.SetParent(UI.transform); //setting slot for its parent slots.Add(UI); } AddItem(1); AddItem(2); if (owner == GameObject.Find("Market Kepper")) { AddItem(2); AddItem(2); AddItem(2); } }
void Start() { int Slotamount = 0; Gameitem = Gameitem.gameObject.GetComponent <CharactorController>(); database = GameObject.FindGameObjectWithTag("ItemDataBase").GetComponent <ItemDataBase>(); for (int i = 1; i < 6; i++) { for (int k = 1; k < 5; k++) { GameObject slot = (GameObject)Instantiate(slots); slot.GetComponent <SlotScript>().slotNumber = Slotamount; Slots.Add(slot); Items.Add(new Item()); slot.transform.SetParent(this.gameObject.transform); slot.name = "Slot" + i + "." + k; slot.GetComponent <RectTransform>().localPosition = new Vector3(x, y, 0); x = x + 50; if (k == 4) { x = -77; y = y - 40; } Slotamount++; } } }
void CreateDataBase() { _items = ScriptableObject.CreateInstance <ItemDataBase>(); AssetDatabase.CreateAsset(_items, "Assets/Resources/ItemDatBase.asset"); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
private void Awake() { if (m_itemDataBase == null) { m_itemDataBase = (ItemDataBase)Resources.Load("Data/ItemDataBase"); } }
// Use this for initialization void Start() { gameManager = GameObject.Find("GameManager_mn"); itemDataScript = gameManager.GetComponent <ItemDataBase>(); gameEventScript = gameManager.GetComponent <GameEvents>(); playerStScript = GetComponent <PlayerStats>(); if (networkView.isOwner == true) { CreateItemStore(); //ADD ALL MYITEMSLOTS GAMEOBJECTS TO A LIST foreach (GameObject slotObj in GameObject.FindGameObjectsWithTag("MyItemSlot")) { mySlotItems.Add(slotObj); //SEND A REFERENCE OF THIS SCRIPT TO EACH SLOT slotObj.GetComponent <ItemMySlot>().itemManagementScript = GetComponent <ItemManagement>(); } } //FILL MY CURRENT ITEMS LIST WITH EMPTY DATA for (int i = 1; i <= 6; i++) { Items tmpItem = new Items(); tmpItem.itemType = ItemDataClass.ItemType.Empty; myItems.Add(tmpItem); } }
void Awake() { equipSlots = new GameObject[6]; database = GetComponent <ItemDataBase>(); recipes = GetComponent <RecipeDataBase>(); slotNumber = 60; recipesNumber = 2; inventoryPanel = GameObject.Find("Inventory Panel"); charPanel = GameObject.Find("EquipmentPanel"); craftingPanel = GameObject.Find("CraftingPanel"); recipePanel = GameObject.Find("RecipePanel"); craftingPanel.SetActive(false); charPanel.SetActive(false); inventoryPanel.SetActive(false); slotPanel = inventoryPanel.transform.Find("Slot Panel").gameObject; for (int i = 0; i < slotNumber; i++) { items.Add(new Item()); mainSlots.Add(Instantiate(inventorySlot)); mainSlots[i].transform.SetParent(slotPanel.transform); } for (int i = 0; i < recipesNumber; i++) { recipesFound.Add(Instantiate(recipeSlot)); recipesFound[i].transform.Translate(Vector3.zero); recipesFound[i].transform.SetParent(recipePanel.transform); //AddRecipe(i); } }
private void Start() { database = GetComponent <ItemDataBase>(); slotsAmount = 88; inventoryPanel = GameObject.Find("Inventory Panel"); slotPanel = inventoryPanel.transform.Find("Slot Panel").gameObject; for (int i = 0; i < slotsAmount; i++) { items.Add(new Item()); slots.Add(Instantiate(InventorySlot)); slots[i].GetComponent <Slot>().id = i; slots[i].transform.SetParent(slotPanel.transform); } AddItem(0); AddItem(1); AddItem(1); AddItem(1); AddItem(1); AddItem(2); AddItem(2); RemoveItem(0); }
void Awake() { if (instance == null) { instance = this; } }
public void OnGainAnimal(stGainAnimalHomeUserCmd_CS cmd) { ItemDataBase db = GameTableManager.Instance.GetTableItem <ItemDataBase>((uint)cmd.item_id1); if (db != null) { TipsManager.Instance.ShowTipsById(114502, db.itemName, cmd.num1); } ItemDataBase db2 = GameTableManager.Instance.GetTableItem <ItemDataBase>((uint)cmd.item_id2); if (db2 != null) { TipsManager.Instance.ShowTipsById(114502, db2.itemName, cmd.num2); } int seedID = (int)cmd.seed_id; int landIndex = (int)(cmd.land_id + animalIndexStart); long entityID = 0; HomeEntityInfo info = GetHomeEntityByIndex(EntityType.EntityType_Animal, landIndex, out entityID); if (entityID != 0) { DeleteHomeEntity(entityID); } DeleteCanCainLand(landIndex); DeletePlantAndAnimalRemainTime(landIndex); RefreshLandUI(); }
void InitLabel() { if (CurSkillDataBase != null) { m_label_xuejineng_Skillname.text = CurSkillDataBase.strName; m_label_xuejineng_SkillLevel.text = CurSkillDataBase.wdLevel.ToString() + CommonData.GetLocalString("级"); if (m__skilldes_xuejineng_icon != null) { UIManager.GetTextureAsyn(CurSkillDataBase.iconPath, ref m_iconCASD, () => { if (null != m__skilldes_xuejineng_icon) { m__skilldes_xuejineng_icon.mainTexture = null; } }, m__skilldes_xuejineng_icon); } m_label_xuejineng_NowLevel.text = CurSkillDataBase.strDesc; m_label_skilltype.text = petDataManager.GetSkillTypeStr((PetSkillType)CurSkillDataBase.petType); string itemArray = CurSkillDataBase.needItemArray; string[] itemIDArray = itemArray.Split(';'); if (itemIDArray.Length < 1) { Log.Error("skilldatabase needitemarray error lenght less than 2 skillid is " + CurSkillDataBase.wdID); return; } string[] itemNum = itemIDArray[0].Split('_'); if (itemNum.Length < 2) { Log.Error("skilldatabase needitemarray error lenght less than 2 skillid is " + CurSkillDataBase.wdID); return; } uint itemID = uint.Parse(itemNum[0]); uint needNum = uint.Parse(itemNum[1]); UIManager uiMan = DataManager.Manager <UIManager>(); int itemCount = DataManager.Manager <ItemManager>().GetItemNumByBaseId(itemID); m_nItemID = itemID; m_label_xuejineng_number.text = StringUtil.GetNumNeedString(itemCount, needNum); UIItem.AttachParent(m_sprite_xuejineng_icon.transform, itemID, (uint)itemCount, ShowGetWayCallBack); ShowLearnSkillColdLabel(itemID); int count = 0; PetSkillLearnDataBase learnDb = GameTableManager.Instance.GetTableItem <PetSkillLearnDataBase>((uint)count); if (learnDb != null) { m_label_suoding_xiaohao.text = learnDb.needDianJuan.ToString(); } m_label_xuejineng_goldxiaohao.text = CurSkillDataBase.dwMoney.ToString(); ItemDataBase itemDb = GameTableManager.Instance.GetTableItem <ItemDataBase>(itemID); if (itemDb != null) { int num = DataManager.Manager <ItemManager>().GetItemNumByBaseId(itemDb.itemID); m_label_xuejineng_name.text = itemDb.itemName; m_label_xuejineng_number.text = StringUtil.GetNumNeedString(itemCount, needNum); } SetLockSkillNum(petDataManager.LockSkillNum); } }
// to load from data base public void loadFromDB() { XmlSerializer serializer = new XmlSerializer(typeof(ItemDataBase)); FileStream stream = new FileStream(Application.dataPath + "/Resources/xml/db.xml", FileMode.Open); itemDB = serializer.Deserialize(stream) as ItemDataBase; stream.Close(); }
// load function public void loadItems() { XmlSerializer serializer = new XmlSerializer(typeof(ItemDataBase)); FileStream stream = new FileStream(Application.dataPath + "/UnitySaveDataSampleAsset/example03/StreamingFiles/XML/item_data.xml", FileMode.Open); itemDB = serializer.Deserialize(stream) as ItemDataBase; stream.Close(); }
// Use this for initialization void Start() { itemdatabase = GetComponent <ItemDataBase>(); slotPanel = GameObject.Find("Slot_Panel"); Init_database(); }
void LoadDataBase(){ _items = (ItemDataBase)AssetDatabase.LoadAssetAtPath<ItemDataBase> ("Assets/Resources/ItemDatBase.asset"); so = new SerializedObject(_items); if(_items==null) CreateDataBase(); }
void LoadDataBase(){ _items = (ItemDataBase)AssetDatabase.LoadAssetAtPath<ItemDataBase> ("Assets/Resources/ItemDataBase.asset"); if(_items==null) CreateDataBase(); }
public void Start() { itemRigidBody = GetComponent <Rigidbody>(); mesh = gameObject.transform.GetChild(0); itemDataBase = GameObject.Find("GameManager").GetComponent <ItemDataBase>(); itemInformation = itemDataBase.availableItems[itemInformationID]; rotationValue = new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-1f, 1f)); rotationSpeed = Random.Range(1.1f, 3); }
public void ShowItemTooltip(Item item) { ItemDataBase db = ItemDataBase.instance; this.item = item; if (this.item != null && this.item.value > 0) { if (!item.type.ToString().Equals(((float)TypeOfItem.Type.Other).ToString())) { Name.text = GetItemName(item.type, item.id); HP.text = ": " + item.hp; Dame.text = ": " + item.dame; Power.text = ": " + item.power; if (db != null) { Name.color = db.GetColor(item.levelUpgrade); Background.sprite = db.GetBackground(item.levelUpgrade); Icon.sprite = db.GetItemSprite(item.type.ToString(), item.id.ToString(), item.levelUpgrade.ToString()); // Type.color = db.GetItemType(item.type.ToString()); // Type.gameObject.SetActive(true); } _equip.gameObject.SetActive(true); _unequip.gameObject.SetActive(false); Other.SetActive(false); NotOther.SetActive(true); } else { OtherText.text = "That's item which is so f*****g incredible"; if (db != null) { if (item.id.ToString().Equals("0")) { Background.sprite = db.GetBackground(item.levelUpgrade); } else { Background.color = new Color(0, 0, 0, 0); } Icon.sprite = db.GetItemSprite(item.type.ToString(), item.id.ToString(), item.levelUpgrade.ToString()); //Type.gameObject.SetActive(false); } _equip.gameObject.SetActive(false); _unequip.gameObject.SetActive(false); Other.SetActive(true); NotOther.SetActive(false); } Background.gameObject.SetActive(true); Icon.gameObject.SetActive(true); } else { HideItemTooltip(); } }
public UnitLoadData(UnitSaveData unitSaveData, ItemDataBase itemDataBase) { unitName = unitSaveData.unitName; unitClass = unitSaveData.unitClass; unitLevel = unitSaveData.unitLevel; unitExp = unitSaveData.unitExp; unitAbilities = unitSaveData.unitAbilities; unitStats = unitSaveData.unitStats; unitInventory = unitSaveData.unitInventory.GetCopyOfItems(itemDataBase); }
void LoadDataBase() { _items = (ItemDataBase)AssetDatabase.LoadAssetAtPath <ItemDataBase> ("Assets/Resources/ItemDatBase.asset"); so = new SerializedObject(_items); if (_items == null) { CreateDataBase(); } }
//генерация предмета public ItemDataBase ItemGen(int win_id) { ItemDataBase item = new ItemDataBase(); item.Name = ItemList[win_id].Name; item.Id = ItemList[win_id].Id; item.IconPatch = ItemList[win_id].IconPatch; item.Description = ItemList[win_id].Description; return(item); }
//public IEnumerator ProjectileMultihit(Transform target,float dmg,bool headshot, UnityAction dmgScript, int invcationCount ) //{ // for (int i = 0; i < invcationCount; i++) // { // yield return null; // dmgScript.Invoke(); // ModdedPlayer.instance.DoAreaDamage(target.root, dmg); // ModdedPlayer.instance.OnHit(); // ModdedPlayer.instance.OnHit_Ranged(target); // } //} public IEnumerator AsyncSendRandomItemDrops(int count, EnemyProgression.Enemy type, long bounty, ModSettings.Difficulty difficulty, Vector3 position) { for (int i = 0; i < count; i++) { yield return(null); yield return(null); Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(bounty, type, difficulty), position + Vector3.up * (2f + i / 4) + Random.Range(-1, 1) * Vector3.forward + Random.Range(-1, 1) * Vector3.right, ItemPickUp.DropSource.EnemyOnDeath); } }
public void RefreshUI() { string itemName = "Item_"; #region leftui for (int i = 1; i < 4; i++) { Transform item = m_widget_ItemContent.transform.Find(itemName + i.ToString()); if (item != null) { Transform bg = item.Find("bg_" + i.ToString()); UIEventListener.Get(bg.gameObject).onClick = OnSelectItem; CompassDataBase db = compassList[i - 1]; if (db != null) { uint itemID = db.dwID; ItemDataBase idb = GameTableManager.Instance.GetTableItem <ItemDataBase>(itemID); if (idb != null) { int count = DataManager.Manager <ItemManager>().GetItemNumByBaseId(itemID); Transform icon = item.Find("icon"); if (icon != null) { UIItem.AttachParent(icon, itemID, (uint)count); } Transform name = item.Find("name"); if (name != null) { UILabel label = name.GetComponent <UILabel>(); if (label != null) { label.text = idb.itemName; } } Transform des = item.Find("description"); if (des != null) { UILabel label = des.GetComponent <UILabel>(); if (label != null) { label.text = idb.description; } } } } } } #endregion ShowStoneUIByData(homeDM.StoneID, homeDM.ComPassID, homeDM.GainStoneNum); ShowBtn(); RefreshMineState(); }
// Use this for initialization void Start () { database = ItemDataBase.GetDataBase (); parent = this.gameObject; childAmount = parent.transform.childCount; for (int i = 0; i < childAmount; i++) { shopSlot.Add(parent.transform.GetChild (i).gameObject); //print (shopSlot[i].gameObject.name); } for (int i = 0; i < shopSlot.Count; i++) { FindItems (shopSlot[i].name, i); } }
// Use this for initialization void Start () { database = ItemDataBase.GetDataBase(); //inventoryPanel = GameObject.Find("Inventory_Panel"); //slotPanel = inventoryPanel.transform.FindChild("Slot_Panel").gameObject; for(int i =0;i<slotAmount;i++){ items.Add(new Item()); slots.Add (Instantiate(inventorySlot)); slots[i].GetComponent<UI_Slot>().id = i; slots[i].transform.SetParent(slotPanel.transform); } AddItem(0); AddItem(1); AddItem(1); AddItem(1); }
void DrawEnhancerList(ItemDataBase control) { ItemIndex = EditorGUILayout.IntSlider("Item Index", ItemIndex, 0, control.EnhancerList.Count - 1); EditorGUILayout.BeginHorizontal(); if(GUILayout.Button("Add Item")) { var newEnhancer = new Enhancer(); newEnhancer.Type = ItemType.Enhancer; control.EnhancerList.Add(newEnhancer); ItemIndex = control.EnhancerList.Count - 1; } if(GUILayout.Button("Remove Item")) { control.EnhancerList.RemoveAt(ItemIndex); ItemIndex = control.EnhancerList.Count - 1; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); CommonItemProps(control.EnhancerList[ItemIndex]); }
void DrawArmorList(ItemDataBase control) { ItemIndex = EditorGUILayout.IntSlider("Item Index", ItemIndex, 0, control.ArmorList.Count - 1); EditorGUILayout.BeginHorizontal(); if(GUILayout.Button("Add Item")) { var newArmor = new Armor(); newArmor.Type = ItemType.Armor; control.ArmorList.Add(newArmor); ItemIndex = control.ArmorList.Count - 1; } if(GUILayout.Button("Remove Item")) { control.ArmorList.RemoveAt(ItemIndex); ItemIndex = control.ArmorList.Count - 1; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); CommonItemProps(control.ArmorList[ItemIndex]); control.ArmorList[ItemIndex].Fits = (ArmorType)EditorGUILayout.EnumPopup("Fits ", control.ArmorList[ItemIndex].Fits); control.ArmorList[ItemIndex].ArmorValue = EditorGUILayout.FloatField("Armor Value", control.ArmorList[ItemIndex].ArmorValue); control.ArmorList[ItemIndex].DefenseValue = EditorGUILayout.FloatField("Defense Value", control.ArmorList[ItemIndex].DefenseValue); }
void DrawWeaponList(ItemDataBase control) { ItemIndex = EditorGUILayout.IntSlider("Item Index", ItemIndex, 0, control.WeaponList.Count - 1); EditorGUILayout.BeginHorizontal(); if(GUILayout.Button("Add Item")) { var newWeapon = new Weapon(); newWeapon.Type = ItemType.Weapon; control.WeaponList.Add(newWeapon); ItemIndex = control.WeaponList.Count - 1; } if(GUILayout.Button("Remove Item")) { control.WeaponList.RemoveAt(ItemIndex); ItemIndex = control.WeaponList.Count - 1; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); CommonItemProps(control.WeaponList[ItemIndex]); control.WeaponList[ItemIndex].MinDamage = EditorGUILayout.FloatField("Min Damage", control.WeaponList[ItemIndex].MinDamage); control.WeaponList[ItemIndex].MaxDamage = EditorGUILayout.FloatField("Max Damage", control.WeaponList[ItemIndex].MaxDamage); control.WeaponList[ItemIndex].MinRange = EditorGUILayout.FloatField("MinRange", control.WeaponList[ItemIndex].MinRange); control.WeaponList[ItemIndex].MaxRange = EditorGUILayout.FloatField("MaxRange", control.WeaponList[ItemIndex].MaxRange); control.WeaponList[ItemIndex].CriticalStrike = EditorGUILayout.FloatField("CriticalStrike", control.WeaponList[ItemIndex].CriticalStrike); control.WeaponList[ItemIndex].BatteryRecharge = EditorGUILayout.FloatField("BatteryRecharge", control.WeaponList[ItemIndex].BatteryRecharge); control.WeaponList[ItemIndex].Exhaustion = EditorGUILayout.FloatField("Exhaustion", control.WeaponList[ItemIndex].Exhaustion); }
void LoadDataBase(){ _items = (ItemDataBase)AssetDatabase.LoadAssetAtPath<ItemDataBase> ("Assets/Resources/ItemDatBase.asset"); }
void Start() { for(int i = 0; i < (slotX * slotY); i++) { slots.Add(new Item()); inventory.Add(new Item()); } database = GameObject.FindGameObjectWithTag ("Item Database").GetComponent<ItemDataBase> (); addItem (0); addItem (1); addItem (2); addItem (3); addItem (4); addItem (5); addItem (6); addItem (7); addItem (8); addItem (9); addItem (10); }