示例#1
0
    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);
    }
示例#2
0
    private void InitUI()
    {
        PlayerDataModule module = ModuleManager.Instance.FindModule <PlayerDataModule>();

        if (module == null)
        {
            return;
        }

        DefenceObj       defencedata    = module.GetItemByIDAndPos(uiparam.itemid, uiparam.packpos, uiparam.packtype) as DefenceObj;
        DefenceTableItem defenceItemold = DataManager.DefenceTable[uiparam.itemid] as DefenceTableItem;

        if (null == defencedata || null == defenceItemold)
        {
            return;
        }

        DefenceCombItem combItem = DataManager.DefenceCombTable[defenceItemold.combId] as DefenceCombItem;

        if (null == combItem)
        {
            PopTipManager.Instance.AddNewTip(StringHelper.GetString("promote_max"));
            return;
        }

        DefenceTableItem defenceitempromote = DataManager.DefenceTable[combItem.defenceproducedId] as DefenceTableItem;

        //打开二级界面,显示需要的材料,玩家拥有的材料,装备升阶需要的等级
        NormalItemTableItem normalitem = DataManager.NormalItemTable[combItem.item1] as NormalItemTableItem;

        if (null == normalitem)
        {
            return;
        }
        UIAtlasHelper.SetSpriteImage(mItem1pic, normalitem.picname);
        mItem1name.text = normalitem.name + "X" + combItem.num1;
        normalitem      = DataManager.NormalItemTable[combItem.item2] as NormalItemTableItem;
        UIAtlasHelper.SetSpriteImage(mItem2pic, normalitem.picname);
        mItem2name.text = normalitem.name + "X" + combItem.num2;

        uint playerhascitem1 = module.GetItemNumByID(combItem.item1, PackageType.Pack_Bag);
        uint playerhascitem2 = module.GetItemNumByID(combItem.item2, PackageType.Pack_Bag);

        if (combItem.num1 > playerhascitem1)
        {
            mHasitem1.text = "[E92224]";
        }
        else
        {
            mHasitem1.text = "[FAFDF4]";
        }

        if (combItem.num2 > playerhascitem2)
        {
            mHasitem2.text = "[E92224]";
        }
        else
        {
            mHasitem2.text = "[FAFDF4]";
        }
        mHasitem1.text += playerhascitem1.ToString();
        mHasitem2.text += playerhascitem2.ToString();

        if (defenceitempromote.uselevel > module.GetLevel())
        {
            mLvhint.text = "[E92224]";
        }
        else
        {
            mLvhint.text = "[FAFDF4]";
        }
        mLvhint.text += StringHelper.GetString("defencepromotehint").Replace("?", defenceitempromote.uselevel.ToString());
    }
示例#3
0
    private void SetZoneReward()
    {
        ZoneRewardItem zonereward = DataManager.ZoneRewardTable[mParam.zoneid] as ZoneRewardItem;


        if (null == zonereward)
        {
            GameDebug.LogError("战区数据配置错误,战区ID = " + mParam.zoneid);
            return;
        }

        int index = 0;

        if (uint.MaxValue != zonereward.gamemoney)
        {
            UISprite sp   = ObjectCommon.GetChildComponent <UISprite>(mItemInfoList[index], "sprite1");
            UISprite icon = ObjectCommon.GetChildComponent <UISprite>(mItemInfoList[index], "icon");
            UIAtlasHelper.SetSpriteImage(sp, null);
            UIAtlasHelper.SetSpriteImage(icon, "common:jinbi2");
            UILabel lb = ObjectCommon.GetChildComponent <UILabel>(mItemInfoList[index], "num");
            lb.text = "X" + zonereward.gamemoney;

            mItemInfoList[index++].gameObject.SetActive(true);
        }

        if (uint.MaxValue != zonereward.rmbmoney)
        {
            UISprite sp   = ObjectCommon.GetChildComponent <UISprite>(mItemInfoList[index], "sprite1");
            UISprite icon = ObjectCommon.GetChildComponent <UISprite>(mItemInfoList[index], "icon");
            UIAtlasHelper.SetSpriteImage(sp, null);
            UIAtlasHelper.SetSpriteImage(icon, "common:zhuanshi1");
            UILabel lb = ObjectCommon.GetChildComponent <UILabel>(mItemInfoList[index], "num");
            lb.text = "X" + zonereward.rmbmoney;

            mItemInfoList[index++].gameObject.SetActive(true);
        }

        if (uint.MaxValue != zonereward.item1id)
        {
            PlayerDataModule module = ModuleManager.Instance.FindModule <PlayerDataModule>();
            if (null == module)
            {
                return;
            }

            NormalItemTableItem item = DataManager.NormalItemTable[zonereward.item1id] as NormalItemTableItem;
            if (null == item)
            {
                GameDebug.LogError("normalitem.txt中不存在此道具, ID = " + zonereward.item1id);
                return;
            }

            UISprite sp    = ObjectCommon.GetChildComponent <UISprite>(mItemInfoList[index], "sprite1");
            UISprite icon  = ObjectCommon.GetChildComponent <UISprite>(mItemInfoList[index], "icon");
            UILabel  label = ObjectCommon.GetChildComponent <UILabel>(mItemInfoList[index], "label1");
            UIAtlasHelper.SetSpriteImage(icon, item.picname);
            UIAtlasHelper.SetSpriteImage(sp, item.picname2);
            label.text = item.picname3;

            UILabel lb = ObjectCommon.GetChildComponent <UILabel>(mItemInfoList[index], "num");
            lb.text = "X" + zonereward.item1num;

            mItemInfoList[index++].gameObject.SetActive(true);
        }

        if (uint.MaxValue != zonereward.item2id)
        {
            PlayerDataModule module = ModuleManager.Instance.FindModule <PlayerDataModule>();
            if (null == module)
            {
                return;
            }

            NormalItemTableItem item = DataManager.NormalItemTable[zonereward.item2id] as NormalItemTableItem;
            if (null == item)
            {
                GameDebug.LogError("normalitem.txt中不存在此道具, ID = " + zonereward.item2id);
                return;
            }

            UISprite sp    = ObjectCommon.GetChildComponent <UISprite>(mItemInfoList[index], "sprite1");
            UISprite icon  = ObjectCommon.GetChildComponent <UISprite>(mItemInfoList[index], "icon");
            UILabel  label = ObjectCommon.GetChildComponent <UILabel>(mItemInfoList[index], "label1");
            UIAtlasHelper.SetSpriteImage(icon, item.picname);
            UIAtlasHelper.SetSpriteImage(sp, item.picname2);
            label.text = item.picname3;

            UILabel lb = ObjectCommon.GetChildComponent <UILabel>(mItemInfoList[index], "num");
            lb.text = "X" + zonereward.item2num;

            mItemInfoList[index++].gameObject.SetActive(true);
        }

        if (uint.MaxValue != zonereward.item3id)
        {
            PlayerDataModule module = ModuleManager.Instance.FindModule <PlayerDataModule>();
            if (null == module)
            {
                return;
            }

            NormalItemTableItem item = DataManager.NormalItemTable[zonereward.item3id] as NormalItemTableItem;
            if (null == item)
            {
                GameDebug.LogError("normalitem.txt中不存在此道具, ID = " + zonereward.item2id);
                return;
            }

            UISprite sp    = ObjectCommon.GetChildComponent <UISprite>(mItemInfoList[index], "sprite1");
            UISprite icon  = ObjectCommon.GetChildComponent <UISprite>(mItemInfoList[index], "icon");
            UILabel  label = ObjectCommon.GetChildComponent <UILabel>(mItemInfoList[index], "label1");
            UIAtlasHelper.SetSpriteImage(icon, item.picname);
            UIAtlasHelper.SetSpriteImage(sp, item.picname2);
            label.text = item.picname3;

            UILabel lb = ObjectCommon.GetChildComponent <UILabel>(mItemInfoList[index], "num");
            lb.text = "X" + zonereward.item3num;

            mItemInfoList[index++].gameObject.SetActive(true);
        }

        for (int i = index; i < mItemInfoList.Count; ++i)
        {
            mItemInfoList[i].gameObject.SetActive(false);
        }
    }