private void OnOpenBox(object para) { int resid = uiparam.itemid; BoxItemTableItem res = ItemManager.GetItemRes(resid) as BoxItemTableItem; if (res == null) { return; } if (res.condition1 >= 0) { if (!ConditionManager.Instance.CheckCondition(res.condition1)) { PopTipManager.Instance.AddNewTip(StringHelper.GetString("not_condition")); return; } } if (res.condition2 >= 0) { if (!ConditionManager.Instance.CheckCondition(res.condition2)) { PopTipManager.Instance.AddNewTip(StringHelper.GetString("not_condition")); return; } } BoxItemActionParam param = new BoxItemActionParam(); param.op_type = (int)BOX_ITEM_OP_TYPE.OP_TYPE_OPEN; param.bagType = (int)uiparam.packtype; param.bagPos = uiparam.packpos; Net.Instance.DoAction((int)Message.MESSAGE_ID.ID_MSG_BOX_ITEM, param); }
private void OnOpenItemBox() { int resid = uiparam.itemid; BoxItemTableItem res = ItemManager.GetItemRes(resid) as BoxItemTableItem; if (res == null) { return; } string conditiontext = ""; if (res.condition1 >= 0) { conditiontext = ConditionManager.Instance.GetConditionText(res.condition1); } if (res.condition2 >= 0) { conditiontext += ConditionManager.Instance.GetConditionText(res.condition2); } YesOrNoBoxManager.Instance.ShowYesOrNoUI("提示", "开启宝箱需要: " + conditiontext, OnOpenBox); }
private bool CheckItem() { //Hashtable map = null; IDictionaryEnumerator itr = DataManager.NormalItemTable.GetEnumerator(); while (itr.MoveNext()) { NormalItemTableItem norres = itr.Value as NormalItemTableItem; if (ItemManager.GetItemType((uint)norres.id) != ItemType.Normal) { GameDebug.LogError("道具ID非法。id = " + norres.id.ToString()); return(false); } } // map = DataManager.NormalItemTable; // foreach (NormalItemTableItem norres in map.Values) // { // if(ItemManager.GetItemType((uint)norres.id) != ItemType.Normal) // { // GameDebug.LogError("道具ID非法。id = " + norres.id.ToString()); // return false; // } // } itr = DataManager.DefenceTable.GetEnumerator(); while (itr.MoveNext()) { DefenceTableItem deres = itr.Value as DefenceTableItem; if (ItemManager.GetItemType((uint)deres.id) != ItemType.Defence) { GameDebug.LogError("装备ID非法。id = " + deres.id.ToString()); return(false); } } // map = DataManager.DefenceTable; // foreach (DefenceTableItem deres in map.Values) // { // // } itr = DataManager.WeaponTable.GetEnumerator(); while (itr.MoveNext()) { WeaponTableItem wres = itr.Value as WeaponTableItem; if (ItemManager.GetItemType((uint)wres.id) != ItemType.Weapon) { GameDebug.LogError("武器ID非法。id = " + wres.id.ToString()); return(false); } } // map = DataManager.WeaponTable; // foreach (WeaponTableItem wres in map.Values) // { // if (ItemManager.GetItemType((uint)wres.id) != ItemType.Weapon) // { // GameDebug.LogError("武器ID非法。id = " + wres.id.ToString()); // return false; // } // } itr = DataManager.BoxItemTable.GetEnumerator(); while (itr.MoveNext()) { BoxItemTableItem wres = itr.Value as BoxItemTableItem; if (ItemManager.GetItemType((uint)wres.id) != ItemType.Box) { GameDebug.LogError("箱子道具ID非法。id = " + wres.id.ToString()); return(false); } } // map = DataManager.BoxItemTable; // foreach (BoxItemTableItem wres in map.Values) // { // if (ItemManager.GetItemType((uint)wres.id) != ItemType.Box) // { // GameDebug.LogError("箱子道具ID非法。id = " + wres.id.ToString()); // return false; // } // } return(true); }