Example #1
0
 public void SetRewardItem(int buildtype, int num)
 {
     m_iItemID = buildtype;
     sdata.s_itemtypeInfo Info = ItemM.GetItemInfo(m_iItemID);
     if (Info == null)
     {
         Debug.Log("不存在该物品:" + buildtype);
     }
     else
     {
         int quality = ConfigM.GetBigQuality(Info.quality);
         SetHead(Info.gtype, Info.icon, Info.gid);
         if (MyHead.SprQuality != null)
         {
             MyHead.SprQuality.spriteName = quality.ToString();
         }
         if (MyHead.NumLabel != null)
         {
             if (num > 0)
             {
                 MyHead.NumLabel.text = num.ToString();
             }
             else
             {
                 MyHead.NumLabel.text = "";
             }
         }
     }
 }
Example #2
0
    void ClickDown(Vector3 pos)
    {
        sdata.s_itemtypeInfo Info = ItemM.GetItemInfo(m_iItemID);
        if (Info != null)
        {
            string Name        = Info.name;
            int    Level       = Info.level;
            string Description = Info.title.Replace("\\n", System.Environment.NewLine);
            int    Money       = Info.money;
            int    HaveCount   = ItemDC.GetItemCount(m_iItemID);

            m_wnd = WndManager.GetDialog <StageTipWnd>();
            if (Info.gtype == 0)
            {
                m_wnd.SetTipData(pos, StageClickType.Item, Info.icon, Info.quality, Name, Level, Description, HaveCount, Money, Info.gtype);
            }
            else if (Info.gtype == 1)
            {
                m_wnd.SetTipData(pos, StageClickType.Item, Info.gid, Info.quality, Name, Level, Description, HaveCount, Money, Info.gtype);
            }
            if (Info.gtype == 2)
            {
                m_wnd.SetTipData(pos, StageClickType.Item, Info.gid, Info.quality, Name, Level, Description, HaveCount, Money, Info.gtype);
            }
            if (Info.gtype == 3)
            {
                m_wnd.SetTipData(pos, StageClickType.Item, Info.gid, Info.quality, Name, Level, Description, HaveCount, Money, Info.gtype);
            }
        }
    }
Example #3
0
    void BtnGetSoulStone_OnClickEventHandler(UIButton sender)
    {
        sdata.s_itemtypeInfo itemInfo = ItemM.GetItemInfo(m_Info.fragmentTypeID);//当前灵魂石
        ItemComeFromWnd      wnd      = WndManager.GetDialog <ItemComeFromWnd>();

        wnd.SetData(itemInfo, null, m_Info, 4);
    }
Example #4
0
    private void SetUI()
    {
        GameObject go = NDLoad.LoadWndItem("TrapViewItem", MyHead.trap);

        if (go != null)
        {
            TrapViewItem item = go.GetComponent <TrapViewItem>();
            if (item != null)
            {
                item.SetBuildInfo(m_build, null, TrapState.Exit, 2);
            }
        }
        sdata.s_itemtypeInfo info = ItemM.GetItemInfo(m_build.fragmentTypeID);
        if (info != null)
        {
            NGUIUtil.Set2DSprite(MyHead.Spr2DItem, "Textures/item/" + info.icon);
        }
        else
        {
            NGUIUtil.DebugLog("m_build.fragmentTypeID =" + m_build.fragmentTypeID + "not found!");
        }
        NGUIUtil.SetLableText(MyHead.LblItemNum, m_FragmentNum);
        NGUIUtil.SetLableText(MyHead.LblWoodNum, m_wood);
        NGUIUtil.SetLableText(MyHead.LblGoldNum, m_coin);
    }
Example #5
0
    void BtnClick_OnClickHander(UIButton sender)
    {
//		ItemComeFromWnd wnd = WndManager.GetDialog<ItemComeFromWnd>();
        sdata.s_itemtypeInfo itemInfo = ItemM.GetItemInfo(m_itemType);        //当前灵魂石
        ItemComeFromWnd      wnd      = WndManager.GetDialog <ItemComeFromWnd>();

        wnd.SetData(itemInfo, null, null, 1);
    }
Example #6
0
    void BtnSure_OnClickEventHandler(UIButton sender)
    {
        switch (m_wndType)
        {
        case 1:    //确定
            BtnWndBg_OnClickEventHandler(null);
            break;

        case 2:    //合成公式
            TweenLeft();
            EquipComposeWnd wnd = WndManager.GetDialog <EquipComposeWnd>();
            if (wnd)
            {
                EnableBtn(false);
                wnd.SetData(m_iItemTypeID);
            }
            break;

        case 3:    //穿装备
            PdbycWnd wnd1 = WndManager.FindDialog <PdbycWnd>();
            if (wnd1)
            {
                wnd1.SetEquipDataNoReady();
            }
            MyHead.BtnSure.isEnabled = false;
            SoldierDC.Send_SoldierEquipRequest(m_soldierInfo.ID, m_posIndex);
            WndManager.DestoryDialog <EquipmentInfoWnd>();
            break;

        case 4:    //购买
            //堆叠数量上限判定
            bool overLimit = ItemDC.CheckItemOverLimit(m_iItemTypeID, m_iBuyCount);
            if (overLimit)
            {
                NGUIUtil.ShowTipWndByKey(30000030);
                break;
            }
            //持有代币是否足够
            bool currencyEnough = UserDC.CheckCurrencyEnough(m_iBuyCurrency, m_iBuyPrice);
            if (currencyEnough)
            {
            }
            else
            {
                string currencyName = NGUIUtil.GetStringByKey(99700000 + m_iBuyCurrency);
                string tipText      = string.Format(NGUIUtil.GetStringByKey(30000029), currencyName);
                //NGUIUtil.ShowTipWnd(tipText);
                NGUIUtil.ShowFreeSizeTipWnd(tipText);
            }
            break;

        case 5:    //获得途径
            ItemComeFromWnd Formwnd = WndManager.GetDialog <ItemComeFromWnd>();
            s_itemtypeInfo  info    = ItemM.GetItemInfo(m_iItemTypeID);
            Formwnd.SetData(info, m_soldierInfo, null);
            break;
        }
    }
Example #7
0
    void SetUI(ref List <int> listUsedItem)
    {
        s_itemtypeInfo info = ItemM.GetItemInfo(m_itemTypeID);

        if (info != null)
        {
            NGUIUtil.Set2DSprite(Spr2dEquipIcon, "Textures/item/", info.icon.ToString());
            int quality = ConfigM.GetBigQuality(info.quality);
            NGUIUtil.SetSprite(SprEquipQuality, quality.ToString());
        }
        else
        {
            NGUIUtil.DebugLog(" ItemM.GetItemInfo " + m_itemTypeID.ToString() + " not found!");
            return;
        }
        //设置装备总数量和合成所需的数量
        int totalCount = ItemDC.GetItemCount(m_itemTypeID);
        int countUsed  = listUsedItem.Count;

        if (totalCount > 0)
        {
            int nCountTemp = totalCount;
            int nCnt       = 0;
            for (nCnt = 0; nCnt < countUsed; nCnt++)
            {
                if (listUsedItem[nCnt] == m_itemTypeID)
                {
                    nCountTemp--;
                    if (nCountTemp == 0)
                    {
                        break;
                    }
                }
            }
            for (nCnt = 0; nCnt < m_iNeedNum; nCnt++)
            {
                listUsedItem.Add(m_itemTypeID);
            }
            if (nCountTemp < m_iNeedNum)
            {
                totalCount = nCountTemp;
            }
        }
        string numText = "";

        if (totalCount >= m_iNeedNum)
        {
            numText = string.Format("[FFFFFF]{0}/{1}[-]", totalCount, m_iNeedNum);
        }
        else
        {
            numText = string.Format("[FF0000]{0}/{1}[-]", totalCount, m_iNeedNum);
        }
        NGUIUtil.SetLableText <string>(LblNum, numText);
    }
Example #8
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="dItemID"></param>
    /// <param name="posIndex">装备索引 0~5</param>
    /// <param name="solderierInfo"></param>
    public void SetData(int dItemID, int posIndex, SoldierInfo solderierInfo)
    {
        m_iItemID     = dItemID;
        m_soldierInfo = solderierInfo;
        m_iPosIndex   = posIndex;
        m_itemTypeID  = SoldierM.GetSoldierEquip(solderierInfo.SoldierTypeID, solderierInfo.Quality, posIndex);
        if (m_itemTypeID == 0)
        {
            NGUIUtil.DebugLog(string.Format(" SoldierTypeID={0},Quality={1},EquipIndex={2} 装备静态数据未配置", solderierInfo.SoldierTypeID, solderierInfo.Quality, posIndex));
            return;
        }
        if (m_iItemID == 0)//当未穿装备时
        {
            ItemTypeInfo info = ItemDC.SearchItem(m_itemTypeID);
            if (info != null)
            {
                m_iItemID    = info.ID;
                m_itemTypeID = info.itemType;
                m_icon       = info.m_Icon;
            }
            else
            {
                s_itemtypeInfo sInfo = ItemM.GetItemInfo(m_itemTypeID);
                if (sInfo != null)
                {
                    m_icon = sInfo.icon;
                }
                else
                {
                    NGUIUtil.DebugLog("itemTypeID =" + m_itemTypeID + " 未配置");
                }
            }
        }
        else//已装备
        {
            ItemTypeInfo info1 = ItemDC.GetItem(m_iItemID);
            if (info1 == null || info1.Positon == 0)
            {
                NGUIUtil.DebugLog("获取已装备的信息失败 itemID =" + m_iItemID);
                return;
            }
            m_icon = info1.m_Icon;
            if (info1 != null)
            {
                m_iEquipQuality = info1.m_Quality;
            }
        }
        int itemTypeid = 0;

        m_equipmentPutType = SoldierM.CheckCanPutEquip(solderierInfo, dItemID, posIndex, ref itemTypeid);
        SetUI();
    }
Example #9
0
    /// <summary>
    ///  显示获取灵魂石窗口
    /// </summary>
    void BtnGetSoulStone_OnClickEventHandler(UIButton sender)
    {
        s_itemtypeInfo info = ItemM.GetItemInfo(m_soldierInfo.fragmentTypeID);

        if (info != null)
        {
            ItemComeFromWnd wnd = WndManager.GetDialog <ItemComeFromWnd>();
            if (wnd != null)
            {
                wnd.SetData(info, m_soldierInfo, null, 2);
            }
        }
    }
Example #10
0
    /// <summary>
    /// 检测装备是否存在且符合穿的条件
    /// </summary>
    /// <returns></returns>
    public bool CheckEquipExist()
    {
        m_wndType = 3;
        SetWndType();
        s_itemtypeInfo info = ItemM.GetItemInfo(m_iItemTypeID);

        if (ItemDC.GetItemCount(m_iItemTypeID) > 0 && m_soldierInfo.Level >= info.level)
        {
            MyHead.BtnSure.isEnabled = true;
            return(true);
        }
        MyHead.BtnSure.isEnabled = false;
        return(false);
    }
Example #11
0
    private void CreateItem(s_itemtypeInfo info, int num)
    {
        GameObject go = NDLoad.LoadWndItem("BeiBaoItem", MyHead.TabItem.transform);

        if (go)
        {
            BeiBaoItem item = go.GetComponent <BeiBaoItem>();
            if (item != null)
            {
                item.SetData(ItemM.GetItemInfo(info), num, null);
            }
        }
        MyHead.TabItem.Reposition();
    }
Example #12
0
    private void SetItemReward(stage.StageResource Res)
    {
        if (Res == null)
        {
            return;
        }
        if (Res.rewards == null || Res.rewards.Count == 0)
        {
            return;
        }
        if (MyHead.Rewardtable == null)
        {
            return;
        }


        Dictionary <int, int> l = new Dictionary <int, int>();

        for (int i = 0; i < Res.rewards.Count; i++)
        {
            sdata.s_itemtypeInfo Info = ItemM.GetItemInfo(Res.rewards[i].itemtypeid);
            if (Info == null)
            {
                continue;
            }
            if (l.ContainsKey(Res.rewards[i].itemtypeid) == false)
            {
                l.Add(Res.rewards[i].itemtypeid, Res.rewards[i].superpose);
            }
            else
            {
                l[Res.rewards[i].itemtypeid] = l[Res.rewards[i].itemtypeid] + Res.rewards[i].superpose;
            }
        }
        //
        foreach (int key in l.Keys)
        {
            GameObject go = NDLoad.LoadWndItem("RewardItem", MyHead.Rewardtable.transform);
            if (go != null)
            {
                RewardItem item = go.GetComponent <RewardItem>();
                if (item != null)
                {
                    item.SetRewardItem(key, l[key]);
                }
            }
        }
        MyHead.Rewardtable.enabled = true;
        MyHead.Rewardtable.Reposition();
    }
Example #13
0
 public void SetInfo(int itemID)
 {
     m_stageClickType = StageClickType.Item;
     sdata.s_itemtypeInfo Info = ItemM.GetItemInfo(itemID);
     if (Info != null)
     {
         TipID       = itemID;
         Name        = Info.name;
         Level       = Info.level;
         Description = Info.title;
         Money       = Info.money;
         HaveCount   = ItemDC.GetItemCount(itemID);
         Quality     = Info.quality;
     }
 }
Example #14
0
 public void SetRewardItem(int itemType, int id, int num)
 {
     if (itemType == 1)        //英雄整卡
     {
         s_soldier_typeInfo info = SoldierM.GetSoldierType(id);
         if (info == null)
         {
             NGUIUtil.DebugLog("s_soldiertype id = " + id + " 静态表数据未配置!");
             return;
         }
         else
         {
             SetHead(itemType, 0, info.modeltype);
             MyHead.SprQuality.spriteName = "1";
             MyHead.SprQuality.gameObject.SetActive(true);
         }
     }
     else if (itemType == 2)        //道具/碎片
     {
         s_itemtypeInfo info = ItemM.GetItemInfo(id);
         if (info == null)
         {
             NGUIUtil.DebugLog("s_itemtype id = " + id + " 静态表数据未配置!");
             return;
         }
         else
         {
             SetHead(info.gtype, info.icon, info.gid);
             int quality = ConfigM.GetBigQuality(info.quality);
             MyHead.SprQuality.spriteName = quality.ToString();
         }
     }
     else if (itemType == 3)        //陷阱
     {
         s_building_typeInfo buildinfo = buildingM.GetBuildType(id);
         MyHead.Roomhead.gameObject.SetActive(true);
         NGUIUtil.Set2DSprite(MyHead.Roomhead, "Textures/room/", buildinfo.modeltype.ToString());
         MyHead.SprQuality.spriteName = "1";
     }
     else if (itemType == 4)        //黑科技
     {
         string icon = "Textures/role/" + id;
         MyHead.SprQuality.gameObject.SetActive(true);
         MyHead.CaptainHead.gameObject.SetActive(true);
         NGUIUtil.Set2DSprite(MyHead.CaptainHead, icon);
         MyHead.SprQuality.spriteName = "1";
     }
 }
Example #15
0
    /// <summary>
    /// 802
    /// </summary>
    private static void Recv_ItemGetResponse(object Info)
    {
        if (Info == null)
        {
            return;
        }
        item.ItemInfoResponse response = Info as item.ItemInfoResponse;

        foreach (item.ItemInfo itemInfo in response.item_infos)
        {
            int action = itemInfo.action;
            int id     = itemInfo.id;
            //添加
            if (action == 0)   //新增
            {
                if (m_lItem.ContainsKey(id) == true)
                {
                    ItemTypeInfo I = m_lItem[id];
                    ItemM.UpdateItemInfo(itemInfo, ref I);
                }
                else
                {
                    ItemTypeInfo I = ItemM.GetItemInfo(itemInfo);
                    if (I != null)
                    {
                        m_lItem.Add(id, I);
                    }
                }
            }
            //update
            else if (action == 1)
            {
                if (m_lItem.ContainsKey(id) == true)
                {
                    ItemTypeInfo I = m_lItem[id];
                    ItemM.UpdateItemInfo(itemInfo, ref I);
                }
            }
            else     //删除
            {
                if (m_lItem.ContainsKey(id) == true)
                {
                    m_lItem.Remove(id);
                }
            }
        }
    }
Example #16
0
 public void BtnSelect_OnClickEventHandler(UIButton sender)
 {
     if (m_canExist == true)        //可召唤但未召唤的炮弹兵
     {
         SummonHeroWnd wnd = WndManager.GetDialog <SummonHeroWnd>();
         if (wnd != null)
         {
             wnd.SetData(Info, null, 1);
         }
     }
     else                                                                        //不可召唤的炮弹兵 目前不做处理
     {
         sdata.s_itemtypeInfo itemInfo = ItemM.GetItemInfo(Info.fragmentTypeID); //当前灵魂石
         ItemComeFromWnd      wnd      = WndManager.GetDialog <ItemComeFromWnd>();
         wnd.SetData(itemInfo, Info, null, 3);
     }
 }
Example #17
0
    private void SetUI()
    {
        //设置要合成装备的名称和所需的金币
        s_itemtypeInfo info = ItemM.GetItemInfo(m_itemTypeID);

        if (info != null)
        {
            NGUIUtil.SetLableText <string>(MyHead.LblName, info.name);

            string coinText = "";
            if (m_coin > UserDC.GetCoin())   //金币不够时红色
            {
                coinText = string.Format("{0}{1}", "[B05659]", m_coin);
            }
            else
            {
                coinText = m_coin.ToString();
            }
            NGUIUtil.SetLableText <string>(MyHead.LblCoin, coinText);

            NGUIUtil.Set2DSprite(MyHead.m_ComposeMid.Spr2dEquipIcon, "Textures/item/", info.icon.ToString());
            int quality = ConfigM.GetBigQuality(info.quality);
            NGUIUtil.SetSprite(MyHead.m_ComposeMid.SprEquipQuality, quality.ToString());

            NGUIUtil.Set2DSprite(MyHead.m_ComposeEquip.Spr2dEquipIcon, "Textures/item/", info.icon.ToString());
            NGUIUtil.Set2DSprite(MyHead.m_ComposeMid.Spr2dEquipIcon, "Textures/item/", info.icon.ToString());
            NGUIUtil.SetSprite(MyHead.m_ComposeEquip.SprEquipQuality, quality.ToString());
            NGUIUtil.SetSprite(MyHead.m_ComposeMid.SprEquipQuality, quality.ToString());
        }
        else
        {
            NGUIUtil.DebugLog(" ItemM.GetItemInfo " + m_itemTypeID.ToString() + " not found!");
        }
        m_lCurEquipItems.Clear();
        //创建子装备
        List <int> listUsedItem = new List <int>();

        foreach (var item in m_composeEquipList)
        {
            CreateEquipComposeItem(item.key, item.value, ref listUsedItem);
        }
        listUsedItem.Clear();
        NGUIUtil.RepositionTablePivot(MyHead.EquipMidTable.gameObject);
        ShowSprLines(m_composeEquipList.Count - 1);
    }
Example #18
0
 public void GetTrophies(List <ItemInfo> rewards)
 {
     if (rewards != null)
     {
         for (int i = 0; i < rewards.Count; i++)
         {
             sdata.s_itemtypeInfo Info = ItemM.GetItemInfo(rewards[i].mItemtypeid);
             if (Info == null)
             {
                 continue;
             }
             if (Info.gtype == 1 || Info.gtype == 2 || Info.gtype == 3)
             {
                 m_lRewardInfo.Add(Info);
             }
         }
     }
 }
Example #19
0
 public void GetTrophies(stage.StageResource Res)
 {
     if (Res != null && Res.rewards != null)
     {
         for (int i = 0; i < Res.rewards.Count; i++)
         {
             sdata.s_itemtypeInfo Info = ItemM.GetItemInfo(Res.rewards[i].itemtypeid);
             if (Info == null)
             {
                 continue;
             }
             if (Info.gtype == 1 || Info.gtype == 2 || Info.gtype == 3)
             {
                 m_lRewardInfo.Add(Info);
             }
         }
     }
 }
Example #20
0
    /// <summary>
    /// 获取章节星级奖励
    /// </summary>
    public static Dictionary <s_itemtypeInfo, int> GetChapterRewardItem(int ChapterRewardID, ref int Coin, ref int Diamond)
    {
        Dictionary <s_itemtypeInfo, int> l = new Dictionary <s_itemtypeInfo, int>();

        foreach (s_stage_rewardInfo Info in m_lchapterreward)
        {
            if (Info.id == ChapterRewardID)
            {
                Coin    = Info.reward_coin;
                Diamond = Info.reward_diamond;
                if (Info.num1 > 0 && Info.item1id > 0)
                {
                    s_itemtypeInfo I = new s_itemtypeInfo();
                    I = ItemM.GetItemInfo(Info.item1id);
                    l.Add(I, Info.num1);
                }
                if (Info.num2 > 0 && Info.item2id > 0)
                {
                    s_itemtypeInfo I = new s_itemtypeInfo();
                    I = ItemM.GetItemInfo(Info.item2id);
                    l.Add(I, Info.num2);
                }
                if (Info.num3 > 0 && Info.item3id > 0)
                {
                    s_itemtypeInfo I = new s_itemtypeInfo();
                    I = ItemM.GetItemInfo(Info.item3id);
                    l.Add(I, Info.num3);
                }
                if (Info.num4 > 0 && Info.item4id > 0)
                {
                    s_itemtypeInfo I = new s_itemtypeInfo();
                    I = ItemM.GetItemInfo(Info.item4id);
                    l.Add(I, Info.num4);
                }
                if (Info.num5 > 0 && Info.item5id > 0)
                {
                    s_itemtypeInfo I = new s_itemtypeInfo();
                    I = ItemM.GetItemInfo(Info.item5id);
                    l.Add(I, Info.num5);
                }
            }
        }
        return(l);
    }
Example #21
0
    /// <summary>
    /// 获取炮弹兵适合穿的装备数据
    /// </summary>
    private static void AddEquipAttr(ref SoldierInfo Info)
    {
        if (Info == null || Info.m_AddAttr == null)
        {
            return;
        }
        Info.m_AddAttr.Clear(AddAttrType.Equip);

        List <int> lEquipType = GetAllEquipType(Info);

        foreach (int ItemID in lEquipType)
        {
            s_itemtypeInfo I = ItemM.GetItemInfo(ItemID);
            if (I != null)
            {
                Info.m_AddAttr.SetAddAttrInfo(I);
            }
        }
    }
Example #22
0
 public void BtnSelect_OnClickEventHandler(UIButton sender)
 {
     if (myParent != null && m_ItemType == 1 && m_TrapState == TrapState.Exit)
     {
         TrapShowWnd wnd = WndManager.GetDialog <TrapShowWnd>();
         wnd.SetBuildInfo(m_Info, myParent.m_Build);
     }
     else if (m_TrapState == TrapState.CanSum)
     {
         SummonHeroWnd wnd = WndManager.GetDialog <SummonHeroWnd>();
         if (wnd != null)
         {
             wnd.SetData(null, m_Info, 2);
         }
     }
     else if (m_TrapState == TrapState.CanNotSum)
     {
         sdata.s_itemtypeInfo itemInfo = ItemM.GetItemInfo(m_Info.fragmentTypeID);            //当前灵魂石
         ItemComeFromWnd      wnd      = WndManager.GetDialog <ItemComeFromWnd>();
         wnd.SetData(itemInfo, null, m_Info, 5);
     }
 }
Example #23
0
    /// <summary>
    /// 计算炮弹兵战斗力
    /// </summary>
    private static void CalcSoldierPower(ref SoldierInfo Info)
    {
        if (Info == null)
        {
            return;
        }
        int k1         = 0;
        int k2         = 0;
        int k3         = 0;
        int k4         = 0;
        int k5         = 0;
        int LimitLevel = 0;
        int equipID1   = 0;
        int equipID2   = 0;
        int equipID3   = 0;
        int equipID4   = 0;
        int equipID5   = 0;
        int equipID6   = 0;

        //
        ConfigM.GetSoldierPower(ref k1, ref k2, ref k3, ref k4, ref k5);
        int totalSkillLevel = Info.m_Skill.GetTotalSkillLevel();
        int Power           = totalSkillLevel * k1;

        Power = Power + (k2 + ConfigM.GetQualityIndex(Info.Quality) * k3 + Info.StarLevel * k4) * Info.Level;

        List <int> lQuality = ConfigM.GetPrevQuality(Info.Quality);

        List <int> lEquipType = new List <int>();

        foreach (int quality in lQuality)
        {
            GetUpQualityNeed(Info.SoldierTypeID, quality, ref LimitLevel,
                             ref equipID1, ref equipID2, ref equipID3,
                             ref equipID4, ref equipID5, ref equipID6);
            lEquipType.Add(equipID1);
            lEquipType.Add(equipID2);
            lEquipType.Add(equipID3);
            lEquipType.Add(equipID4);
            lEquipType.Add(equipID5);
            lEquipType.Add(equipID6);
        }
        //当前阶装备类型
        GetUpQualityNeed(Info.SoldierTypeID, Info.Quality, ref LimitLevel,
                         ref equipID1, ref equipID2, ref equipID3,
                         ref equipID4, ref equipID5, ref equipID6);
        //
        if (Info.Equipment0 > 0)
        {
            lEquipType.Add(equipID1);
        }
        if (Info.Equipment1 > 0)
        {
            lEquipType.Add(equipID2);
        }
        if (Info.Equipment2 > 0)
        {
            lEquipType.Add(equipID3);
        }
        if (Info.Equipment3 > 0)
        {
            lEquipType.Add(equipID4);
        }
        if (Info.Equipment4 > 0)
        {
            lEquipType.Add(equipID5);
        }
        if (Info.Equipment5 > 0)
        {
            lEquipType.Add(equipID6);
        }

        int EquipTotalLevel = 0;

        foreach (int EquipType in lEquipType)
        {
            s_itemtypeInfo item = ItemM.GetItemInfo(EquipType);
            if (item != null)
            {
                EquipTotalLevel += item.level;
            }
        }
        //添加装备部分产生的战斗力
        Power = Power + EquipTotalLevel * k5;

        Info.m_combat_power = Power;
    }
Example #24
0
    /// <summary>
    /// 炮弹兵装备格的状态
    /// </summary>
    /// <returns>The can put equip.</returns>
    /// <param name="info">Info.</param>
    /// <param name="EquipID">Equip I.</param>
    /// <param name="index">Index.</param>
    /// <param name="itemTypeID">Item type I.</param>
    public static EquipmentPutType CheckCanPutEquip(SoldierInfo info, int EquipID, int index, ref int itemTypeID)
    {
        itemTypeID = SoldierM.GetSoldierEquip(info.SoldierTypeID, info.Quality, index);

        if (EquipID == 0)
        {
            ItemTypeInfo ItemInfo = ItemDC.SearchItem(itemTypeID);
            if (ItemInfo != null)
            {
                if (info.Level >= ItemInfo.m_level)
                {
                    return(EquipmentPutType.CanPut);
                }
                else
                {
                    return(EquipmentPutType.HaveCannot);
                }
            }
            else
            {
                s_itemtypeInfo sInfo = ItemM.GetItemInfo(itemTypeID);

                List <KeyValue> needSubEquip = new List <KeyValue>();
                int             needCoin     = 0;
                bool            canCombine   = ItemM.GetCombineEquipNeed(itemTypeID, ref needSubEquip, ref needCoin);
                if (canCombine)
                {
                    if (ItemDC.CheckItemsEnough(needSubEquip))
                    {
                        if (needCoin < UserDC.GetCoin())
                        {
                            if (info.Level >= sInfo.level)
                            {
                                return(EquipmentPutType.CanCombinePut);
                            }
                            else
                            {
                                return(EquipmentPutType.CanCombine);
                            }
                        }
                        else
                        {
                            return(EquipmentPutType.CanCombine);
                        }
                    }
                    else if (!ItemDC.CheckItemsEnough(needSubEquip))
                    {
                        return(EquipmentPutType.ReadyCombine);
                    }
                    else
                    {
                        return(EquipmentPutType.None);
                    }
                }
                else
                {
                    return(EquipmentPutType.NoCanCombine);
                }
            }
        }
        else
        {
            return(EquipmentPutType.HavePut);
        }
    }
Example #25
0
    // isSoul是为了兼容闪亮登场界面的信息。
    public static ItemIconInfo GetIconInfo(IconType iconType, int id, bool isSoul, bool isBook)
    {
        ItemIconInfo iconInfo = new ItemIconInfo();

        if (iconType == IconType.IconType_Fragment)
        {
            if (isSoul)
            {
                int soldierTypeId       = SoldierM.GetSoldierStarID(id);
                s_soldier_typeInfo info = SoldierM.GetSoldierType(soldierTypeId);
                if (info == null)
                {
                    NGUIUtil.DebugLog("s_soldiertype id = " + id + " 静态表数据未配置!");
                    return(null);
                }
                else
                {
                    iconType = IconType.IconType_Soldier;
                    id       = info.modeltype;
                }
            }
            else if (isBook)
            {
                iconType = IconType.IconType_Captain;
                int godSkillType = GodSkillM.GetGodSkillType(id);
                id = GodSkillM.GetCaptainID(godSkillType);
            }
        }

        if (iconType == IconType.IconType_Soldier)        //英雄整卡
        {
            s_soldier_typeInfo info = SoldierM.GetSoldierType(id);
            if (info == null)
            {
                NGUIUtil.DebugLog("s_soldiertype id = " + id + " 静态表数据未配置!");
                return(null);
            }
            else
            {
                iconInfo.mType = iconType;
                iconInfo.mName = info.name;
                iconInfo.mID   = info.modeltype;
            }
        }
        else if (iconType == IconType.IconType_Fragment)        //道具/碎片
        {
            s_itemtypeInfo info = ItemM.GetItemInfo(id);
            if (info == null)
            {
                NGUIUtil.DebugLog("s_itemtype id = " + id + " 静态表数据未配置!");
                return(null);
            }
            else
            {
                iconInfo.mType = iconType;
                iconInfo.mName = info.name;
                int soldierTypeId = SoldierM.GetSoldierStarID(id);
                iconInfo.mID = info.gid;
            }
        }
        else if (iconType == IconType.IconType_Bulding)        //陷阱
        {
            s_building_typeInfo buildinfo = buildingM.GetBuildType(id);

            iconInfo.mType = iconType;
            iconInfo.mName = buildinfo.name;
            iconInfo.mID   = buildinfo.modeltype;
        }
        else if (iconType == IconType.IconType_Captain)        //黑科技
        {
            iconInfo.mType = iconType;
            CaptionInfo captionInfo = new CaptionInfo();
            GodSkillM.GetCaption(id, ref captionInfo);
            GodSkillInfo godSkillInfo = new GodSkillInfo();
            GodSkillM.GetGodSkill(captionInfo.m_godskilltype1, 1, ref godSkillInfo);
            iconInfo.mName = godSkillInfo.m_name;
            iconInfo.mID   = id;
        }
        iconInfo.mIsSoul = isSoul;
        iconInfo.mIsBook = isBook;
        return(iconInfo);
    }
Example #26
0
    public void SetData(int itemTypeID, int itemID, SoldierInfo soldeierInfo, int posIndex, int wndType)
    {
        m_vInitPos = MyHead.WndTweenParent.transform.localPosition;

        m_iItemTypeID = itemTypeID;
        m_soldierInfo = soldeierInfo;
        m_posIndex    = posIndex;
        m_iItemID     = itemID;
        m_wndType     = wndType;

        //ItemTypeInfo info = ItemDC.FindEquipByItemTypeID(m_iItemTypeID, 0);
        s_itemtypeInfo info = ItemM.GetItemInfo(m_iItemTypeID);

        if (info == null)
        {
            NGUIUtil.DebugLog("s_itemtypinfo 静态表获取数据失败:" + m_iItemTypeID);
            return;
        }
        m_EquipAttrInfo.SetAddAttrInfo(info);
        //        MyHead.LblFuMo.gameObject.SetActive(false);
        NGUIUtil.Set2DSprite(MyHead.SprEquip, "Textures/item/", info.icon.ToString());
        NGUIUtil.SetLableText <string>(MyHead.LblName, info.name);
        string desc = info.message.Replace("\\n", System.Environment.NewLine);

        NGUIUtil.SetLableText <string>(MyHead.LblDescription, desc);
        string title = info.title.Replace("\\n", System.Environment.NewLine);

        NGUIUtil.SetLableText <string>(MyHead.LblTitle, title);
        SetWndType();
        if (soldeierInfo != null)
        {
            if (soldeierInfo.Level < info.level)
            {
                NGUIUtil.SetLableText <string>(MyHead.LblRequireLevel, NGUIUtil.GetStringByKey("30000014") + info.level.ToString());
                NGUIUtil.SetActive(MyHead.LblRequireLevel.gameObject, true);
                if (wndType == 3)   //装备 窗口状态下设定
                {
                    MyHead.BtnSure.isEnabled = false;
                }
            }
        }

        SetEquipCountUI();

        if (wndType == 4)   //商品购买
        //设定购买件数
        {
            NGUIUtil.SetActive(MyHead.LblBuyCount.gameObject, true);
            string buyCountText = string.Format(NGUIUtil.GetStringByKey(70000020), m_iBuyCount);
            NGUIUtil.SetLableText <string>(MyHead.LblBuyCount, buyCountText);
            //设定价格
            NGUIUtil.SetActive(MyHead.LblTotalPrice.gameObject.transform.parent.gameObject, true);

            bool currencyEnough = UserDC.CheckCurrencyEnough(m_iBuyCurrency, m_iBuyPrice);
            if (currencyEnough)
            {
                NGUIUtil.SetLableText <int>(MyHead.LblTotalPrice, m_iBuyPrice);
            }
            else
            {
                string priceText = string.Format("[FA3B3B]{0}[-]", m_iBuyPrice);
                NGUIUtil.SetLableText <string>(MyHead.LblTotalPrice, priceText);
            }

            //设定代币类型
            NGUIUtil.Set2DSprite(MyHead.Spr2dCurrency, "Textures/currency/", m_iBuyCurrency.ToString());
        }
    }
Example #27
0
    private string GetName(s_signinInfo info)
    {
        string           result = "";
        int              id     = info.item_type;
        SignInRewardType type   = (SignInRewardType)info.reward_type;

        switch (type)
        {
        case SignInRewardType.BlackScience:
            CaptionInfo cInfo = new CaptionInfo();
            GodSkillM.GetCaption(id, ref cInfo);
            GodSkillInfo gInfo = new GodSkillInfo();
            GodSkillM.GetGodSkill(cInfo.m_godskilltype1, 1, ref gInfo);
            result = gInfo.m_name;
            break;

        case SignInRewardType.HeroSoulFragment:
        case SignInRewardType.ItemAndEquip:
        case SignInRewardType.TrapFragment:
        case SignInRewardType.BlackScienceFragment:
            s_itemtypeInfo info1 = ItemM.GetItemInfo(id);
            if (info1 != null)
            {
                result = info1.name;
            }
            break;

        case SignInRewardType.Hero:
            SoldierInfo info2 = SoldierM.GetSoldierInfo(id);
            if (info2 != null)
            {
                result = info2.m_name;
            }
            break;

        case SignInRewardType.Trap:
            BuildInfo info3 = buildingM.GetStartBuildInfo(id);
            if (info3 != null)
            {
                result = info3.m_name;
            }
            break;

        case SignInRewardType.GoldCoin:
            result = NGUIUtil.GetStringByKey(88800061);
            break;

        case SignInRewardType.Diamond:
            result = NGUIUtil.GetStringByKey(99700001);
            break;

        case SignInRewardType.Crystal:
            result = NGUIUtil.GetStringByKey(10000177);
            break;

        case SignInRewardType.Wood:
            result = NGUIUtil.GetStringByKey(10000178);
            break;
        }
        return(result);
    }