public void ClearInfo() //清空格子储存的物品信息 { id = 0; info = null; num = 0; numLabel.enabled = false; }
// Start is called before the first frame update void Awake() { instance = this; //测试 ReadInfo(); //Debug.Log(objectInfoDict.Keys.Count); }
public void ClearInfo() { id = 0; info = null; num = 0; numLabel.enabled = false; }
// Use this for initialization void Awake() { _instance = this; ReadInfo(); // ObjectInfo inf = GetObjectInfoById(2003); // print(inf.name); }
public void SetItemType(int id) { ObjectsInfo info = ObjectInfo._instance.GetOjectInfoById(id); objectType = info.type; dressType = info.dressType; }
public void SetId(int id) { this.id = id; ObjectsInfo info = ObjectsInfo.instance.GetObjectsInfoById(id); SetInfo(info); }
public ObjectsInfo GetObjectsInfoById(int id) { ObjectsInfo info = null; objectInfoDict.TryGetValue(id, out info); return(info); }
void Update() { //鼠标悬停其上时显示物品属性展示栏 if (isHover) { ShowItemInfoById(id); //一般情况下只有鼠标悬停于item上才可右击使用药品 if (Input.GetMouseButtonDown(1)) { switch (ObjectsInfo.Instance().GetObjectInfoById(id).type) { case ObjectInfo.ObjectType.Drug: gridOfItem.UseDrug(); break; //装备栏中和物品栏中右击装备的操作是不一样的 case ObjectInfo.ObjectType.Equip: if (!equiping) { gridOfItem.WearEquip(); } else { this.GetComponentInParent <GridOfEquip>().UnloadThisGridEquip(); } break; } } } else { infoFrame.SetActive(false); } }
private void Start() { manager = GameObject.Find("GameSetting").GetComponent <ButtonManager>(); inventory = GameObject.Find("Inventory").GetComponent <Inventory>(); info = GameObject.Find("GameSetting").GetComponent <ObjectsInfo>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInformation>(); }
public bool Dress(int id, GameObject gO) { ObjectsInfo info = ObjectInfo._instance.GetOjectInfoById(id); if (info.type != ObjectType.Equip) { return(false); } else if (info.applicationType != pStatus.apType && info.applicationType != ApplicationType.Common) { return(false); } else { GameObject parent = null; switch (info.dressType) { case DressType.Accessory: parent = accessory; break; case DressType.Armor: parent = armor; break; case DressType.Shoe: parent = shoe; break; case DressType.Headgear: parent = headgear; break; case DressType.LeftHand: parent = leftHand; break; case DressType.RightHand: parent = rightHand; break; } Ei ei = parent.GetComponentInChildren <Ei>(); if (ei == null) { GameObject itemGo = NGUITools.AddChild(parent, EquipItem); itemGo.transform.localPosition = Vector3.zero; itemGo.GetComponent <Ei>().SetInfo(info); gO.GetComponentInParent <InventoryItemgrid>().ClearInfo(); GameObject.Destroy(gO); } else { oldId = ei.id; ei.SetInfo(info); isExchange = true; } return(true); } }
private void Awake() { equipment = this; objects = GameObject.Find("GameSetting").GetComponent <ObjectsInfo>(); player = GameObject.FindGameObjectWithTag(Tags.player).GetComponent <PlayerInformation>(); inventory = GameObject.Find("Inventory").GetComponent <Inventory>(); myDrag = this.transform.GetComponentInChildren <MyDrag>(); }
void Awake() { //Debug.Log("objectsInfo"); Instance = this; //print(objectInfoDict.Keys.Count); }
public void PlusProperty(int id) //穿上装备增加属性 { ObjectsInfo equipInfo = ObjectsInfo.instance.GetObjectsInfoById(id); ps.attack_plus += equipInfo.attack; ps.def_plus += equipInfo.def; ps.speed_plus += equipInfo.speed; Status.instance.StatusShow(); }
string GetDrugDes(ObjectsInfo info) { string str = ""; str += "名称:" + info.name + "\n"; str += "+hp" + info.hp + "\n"; str += "+mp" + info.mp + "\n"; //str+= "出售价格:" + info.price_sell + "\n"; return(str); }
string GetEquipInfo(ObjectsInfo info) { string str = "\n"; str += " 名称: " + info.name + "\n\n"; switch (info.dressType) { case DressType.Headgear: str += " 穿戴类型: 头盔\n\n"; break; case DressType.Armor: str += " 穿戴类型: 盔甲\n\n"; break; case DressType.RightHand: str += " 穿戴类型: 左手\n\n"; break; case DressType.LeftHand: str += " 穿戴类型: 右手\n\n"; break; case DressType.Shoe: str += " 穿戴类型: 鞋子\n\n"; break; case DressType.Accessory: str += " 穿戴类型: 首饰\n\n"; break; } switch (info.applicationType) { case ApplicationType.Swordman: str += " 适用类型: 剑士\n\n"; break; case ApplicationType.Magician: str += " 适用类型: 魔法师\n\n"; break; case ApplicationType.Common: str += " 适用类型: 通用\n\n"; break; } str += " 攻击值: " + info.attack + "\n\n"; str += " 防御值: " + info.def + "\n\n"; str += " 速度值: " + info.speed + "\n\n"; str += " 出售价: " + info.price_sell + "\n\n"; str += " 购买价: " + info.price_buy + "\n"; return(str); }
public void SetInventory(int id) { this.id = id; objectInfo = ObjectsInfo.instance.GetObjectsInfoById(id); if (objectInfo.type == ObjectsType.Drug) { icon.gameObject.SetActive(true); icon.spriteName = objectInfo.icon_name; type = ShortCutType.Drug; } }
/// <summary> /// 设置当前Grid中的item(记录了id和ObjectInfo即物品全部信息) /// </summary> /// <param name="id">item的id</param> /// <param name="num">item的数量</param> public void SetThisGridItemById(int id, int num = 1) { this.id = id; this.num = num; this.info = ObjectsInfo.Instance().GetObjectInfoById(id); Item item = this.GetComponentInChildren <Item>(); item.SetIconAndId(id, this.info.icon_name); numLabel.enabled = true; numLabel.text = this.num.ToString(); }
string GetDrugInfo(ObjectsInfo info) { string str = "\n"; str += " 名称: " + info.name + "\n\n"; str += " 血量值: " + info.hp + "\n\n"; str += " 魔法值: " + info.mp + "\n\n"; str += " 出售价: " + info.price_sell + "\n\n"; str += " 购买价: " + info.price_buy + "\n"; return(str); }
public void SetId(int id, int num = 1) { this.id = id; info = ObjectsInfo.instance.GetObjectsInfoById(id); InventoryItem item = GetComponentInChildren <InventoryItem>(); item.SetIconName(id, info.icon_name); numLabel.enabled = true; this.num = num; numLabel.text = num.ToString(); }
//protected override void Awake() //{ // //} protected override void Start() { base.Start(); goodsName = this.gameObject.name; GetMessage(this.gameObject.name); equipment = GameObject.Find("Equipment").GetComponent <Equipment>(); inventory = GameObject.Find("Inventory"); objectsInfo = GameObject.Find("GameSetting").GetComponent <ObjectsInfo>(); information = GameObject.FindGameObjectWithTag(Tags.player).GetComponent <PlayerInformation>(); GetMessage(this.gameObject.name); objectInfo = objectsInfo.FindObjectInDictionary(id); }
public void SetIconName(int id, string icon_name) { sprite.spriteName = icon_name; this.id = id; ObjectsInfo info = ObjectInfo._instance.GetOjectInfoById(id); objectType = info.type; if (info.type == ObjectType.Equip) { dressType = info.dressType; } }
static int set_Instance(IntPtr L) { try { ObjectsInfo arg0 = (ObjectsInfo)ToLua.CheckUnityObject(L, 2, typeof(ObjectsInfo)); ObjectsInfo.Instance = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void SetId(int id, int num) { this.id = id; info = ObjectInfo._instance.GetOjectInfoById(id); item = this.GetComponentInChildren <InventoryItem> (); item.SetIconName(info.id, info.icon_name); numLabel.enabled = true; if (info.type != ObjectType.Equip) { this.num += num; numLabel.text = this.num.ToString(); } }
string GeteEquipDes(ObjectsInfo info) { string str = ""; str += "名称:" + info.name + "\n"; switch (info.dressType) { case DressType.Accessory: str += "穿戴部位:首饰 "; break; case DressType.Armor: str += "穿戴部位:衣服 "; break; case DressType.Headgear: str += "穿戴部位:头部 "; break; case DressType.LeftHand: str += "穿戴部位:左手 "; break; case DressType.RightHand: str += "穿戴部位:右手 "; break; case DressType.Shoe: str += "穿戴部位:鞋 "; break; } switch (info.applicationType) { case ApplicationType.Common: str += "职业:通用\n"; break; case ApplicationType.Magician: str += "职业:魔法师\n"; break; case ApplicationType.Swordman: str += "职业:剑士\n"; break; } str += "攻击:" + info.attack; str += "防御:" + info.def; str += "速度:" + info.speed; //str+= "出售价格:" + info.price_sell; return(str); }
/// <summary> /// 随机掉落一个物品 /// </summary> /// <param name="pos">掉落位置</param> public void CreateRandomDropItem(Vector3 pos) { int kind = Random.Range(1, 3); int id = 0; switch (kind) { case 1: id = Random.Range(1001, 1004); break; case 2: id = Random.Range(2001, 2023); break; } item.SetIconAndId(id, ObjectsInfo.Instance().GetObjectInfoById(id).icon_name); Instantiate(item.gameObject, pos + Vector3.up * 0.3f, Quaternion.identity); }
/// <summary> /// 显示id对应的物品信息和展示栏 /// </summary> /// <param name="id">item的id</param> public void ShowItemInfoById(int id) { infoFrame.SetActive(true); ObjectInfo info = ObjectsInfo.Instance().GetObjectInfoById(id); string message = ""; switch (info.type) { case ObjectInfo.ObjectType.Drug: message = GetDrugMessage(info); break; case ObjectInfo.ObjectType.Equip: message = GetEquipMessage(info); break; } infoText.text = message; }
static int ReadInfo(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); ObjectsInfo obj = (ObjectsInfo)ToLua.CheckObject(L, 1, typeof(ObjectsInfo)); UnityEngine.TextAsset arg0 = (UnityEngine.TextAsset)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.TextAsset)); obj.ReadInfo(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// Buy按钮回调 /// </summary> public void BuyButtonClick() { int price = ObjectsInfo.Instance().GetObjectInfoById(id).price_buy; Debug.Log("价格为" + price); if (CoinManager.Instance().ReduceCoin(price)) { //添加进背包 BagBoard.Instance().PickOneItemById(id); } else { Debug.Log("金币不足"); } }
void PlusProperty(Ei ei) { if (ei != null) { ObjectsInfo info = ObjectInfo._instance.GetOjectInfoById(ei.id); if (info == null) { } else { this.attack += info.attack; this.def += info.def; this.speed += info.speed; } } }
static int GetObjectInfoById(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); ObjectsInfo obj = (ObjectsInfo)ToLua.CheckObject(L, 1, typeof(ObjectsInfo)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); ObjectInfo o = obj.GetObjectInfoById(arg0); ToLua.PushObject(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
// Use this for initialization void Awake () { _instance = this; ReadInfo(); print(objectDic.Keys.Count); }
void OnDestroy() { mInstance = null; }
void Awake() { mInstance = this; ReadInfo(); }
void Start() { instance = this; ReadInfos(); }
void Awake() { _instance = this; ReadInfo (); // print(objectInfoDict.Keys.Count); }