예제 #1
0
    /************************公共方法*******************************/
    /// <summary>
    /// 生成UniversalItemCell的静态方法,参数:UniversalItemCell的父物体
    /// </summary>
    /// <param name="parent"></param>
    /// <returns></returns>
    public static UniversalItemCell GenerateItem(Transform parent)
    {
        GameObject go = UIResourceMgr.LoadPrefab("UI/Prefabs/UI_SignIn/UniversalItemCell") as GameObject;

        if (go == null)
        {
            return(null);
        }
        go = GameObject.Instantiate(go, parent.position, parent.transform.rotation) as GameObject;
        if (go == null)
        {
            return(null);
        }

        go.transform.SetParent(parent);
        go.transform.localScale = Vector3.one;
        UniversalItemCell result = go.GetComponent <UniversalItemCell>();

        if (result != null)
        {
            result.LoadAllComponent();
        }

        return(result);
    }
예제 #2
0
    /// <summary>
    /// 显示获得的值文本
    /// </summary>
    private void FightClearingValue()
    {
        string _fightGetTxt = string.Format(GameUtils.getString("ultimatetrial_content32"), m_Self.LimitFightMgr.m_AllDropNum);

        m_FightGetTxt.ShowRichText(_fightGetTxt);//试炼获得勇者证明
        string _desTxt = string.Format(GameUtils.getString("ultimatetrial_content31"), m_Self.LimitFightMgr.m_RoundNum);

        m_DesTxt.text = _desTxt;//试炼描述
        if (m_Self.LimitFightMgr.m_PactIspass == 1)
        {
            m_PowerTxt.text = GameUtils.getString("ultimatetrial_content33");
        }
        else
        {
            m_PowerTxt.text = GameUtils.getString("ultimatetrial_content34");
        }

        //初始化显示获得奖励物品
        if (m_Self.LimitFightMgr.m_DropMap.Count > 0)
        {
            foreach (DictionaryEntry item in m_Self.LimitFightMgr.m_DropMap)
            {
                m_Cell = UniversalItemCell.GenerateItem(m_Grid);
                m_Cell.InitByID((int)item.Key, (int)item.Value);

                //GameObject _go = Instantiate(m_Prefab) as GameObject;
                //_go.transform.parent = m_Grid;
                //_go.transform.localPosition = Vector3.zero;
                //_go.transform.localScale = Vector3.one;
                //_go.transform.FindChild("CosIcon").GetComponent<Image>().sprite = GameUtils.GetSpriteByResourceType((int)item.Key);
                //_go.transform.FindChild("Image/CosCountTxt1").GetComponent<Text>().text = item.Value.ToString();
            }
        }
    }
예제 #3
0
    void CreateItem(string icon, string count, string name, int id = -1)
    {
        UniversalItemCell _cell = UniversalItemCell.GenerateItem(listObj.transform);

        _cell.transform.localScale = Vector3.one;
        _cell.InitBySprite(UIResourceMgr.LoadSprite(common.defaultPath + icon), int.Parse(count));
        _cell.SetText(GameUtils.getString(name), null, null);
        itemsList.Add(_cell);
    }
예제 #4
0
    private void GreatItem(MailItemData mailItem, int isReceive)
    {
        m_Cell = UniversalItemCell.GenerateItem(EmailFuJianList.transform);

        int type   = mailItem.m_objectid / 1000000;
        int itemid = mailItem.m_objectid;//掉落物ID

        m_Cell.SetCheckClaim(isReceive == 1, "");

        switch (type)
        {
        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES:
            ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid);
            if (_temp_res != null)
            {
                m_Cell.InitByID(itemid, mailItem.m_dropnum);
                m_Cell.SetText(GameUtils.getString(_temp_res.getName()), "", "");
            }
            break;

        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE:     //符文
        {
            ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid);
            if (itemTable != null)
            {
                m_Cell.InitByID(itemid, -1);
                m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", "");
            }
        }
        break;

        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON:
        {
            ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid);
            if (itemTable != null)
            {
                m_Cell.InitByID(itemid, mailItem.m_dropnum);
                m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", "");
            }
        }
        break;

        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO:
        {
            HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(itemid);
            if (hero != null)
            {
                m_Cell.InitByID(itemid, mailItem.m_dropnum);
                m_Cell.SetText(GameUtils.getString(hero.getTitleID()), "", "");
            }
        }
        break;

        default:
            break;
        }
    }
예제 #5
0
    void CreateItem(int tableId, string count, string name)
    {
        UniversalItemCell _cell = UniversalItemCell.GenerateItem(listObj.transform);

        _cell.transform.localScale = Vector3.one;
        _cell.InitByID(tableId, int.Parse(count));
        _cell.SetText(GameUtils.getString(name), null, null);
        _cell.AddClickListener(OnItemClick);
        itemsList.Add(_cell);
    }
    private void UpdateAwardIconItem(int index, RectTransform cell)
    {
        AwardIconData     temp = m_AwardIconData[index];
        UniversalItemCell _UniversalItemCell = cell.GetComponent <UniversalItemCell>();

        if (_UniversalItemCell == null)
        {
            _UniversalItemCell = cell.gameObject.AddComponent <UniversalItemCell>();
        }
        GreatAwardItem(temp.m_index, temp.m_GameactivityTemplate, _UniversalItemCell);
    }
예제 #7
0
 public override void InitUIData()
 {
     base.InitUIData();
     //m_RewardImg = selfTransform.FindChild("Icon").GetComponent<Image>();
     m_GetObj  = selfTransform.FindChild("Image").gameObject;
     m_GetText = selfTransform.FindChild("Image/Text").GetComponent <Text>();
     m_Layout  = selfTransform.FindChild("Layout");
     //m_RewardNum = selfTransform.FindChild("Num").gameObject;
     //m_RewardTxt = selfTransform.FindChild("Num/Text").GetComponent<Text>();
     m_Cell = UniversalItemCell.GenerateItem(m_Layout);
 }
예제 #8
0
        public static AwardItem GenerateItem(Transform layout)
        {
            if (layout == null)
            {
                return(null);
            }
            AwardItem _item = new AwardItem();

            _item.m_Cell = UniversalItemCell.GenerateItem(layout);
            return(_item);
        }
예제 #9
0
        public AwardData(GameObject go)
        {
            m_SelfGameObject = go;

            Transform trans = go.transform;

            m_AwardTittleText = trans.FindChild("AwardTittleText").GetComponent <Text>();
            m_DayText         = trans.FindChild("DayText").GetComponent <Text>();
            m_AwardItemLayout = trans.FindChild("AwardItemPanel/AwardItemLayout");
            m_AwardNameText   = trans.FindChild("AwardItemPanel/AwardNameText").GetComponent <Text>();
            m_Cell            = UniversalItemCell.GenerateItem(m_AwardItemLayout);
        }
예제 #10
0
    public void SetData(int[] innerDropIds)
    {
        ClearItems();

        //for (int i = 0, j = innerDropIds.Length; i < j;  i++)
        //{
        //    InnerdropTemplate value = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(innerDropIds[i]);
        //    if (value == null) continue;

        //    Sprite icon = DynamicItem.GetSprite(value.getObjectid());

        //    RewardViewItemUI ui = GenerateItemUI(value.getDropnum(), icon);
        //    if (ui != null)
        //    {
        //        mItemsList.Add(ui);
        //    }
        //}

        for (int i = 0, j = innerDropIds.Length; i < j; i++)
        {
            foreach (int k in DataTemplate.GetInstance().m_InnerdropTable.GetDataKeys())
            {
                InnerdropTemplate _it = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(k);

                if (_it == null)
                {
                    continue;
                }

                if (_it.getInnerdropid() == innerDropIds[i])
                {
                    //Sprite icon = DynamicItem.GetSprite(_it.getObjectid());

                    //RewardBoxItemUI ui = GenerateItemUI(_it.getDropnum(), icon);
                    //if (ui != null)
                    //{
                    //    mItemsList.Add(ui);
                    //}

                    UniversalItemCell cell = UniversalItemCell.GenerateItem(mListTrans);
                    cell.InitByID(_it.getObjectid(), _it.getDropnum());
                    if (cell != null)
                    {
                        mItemsList.Add(cell);
                    }
                }
            }
        }
    }
예제 #11
0
    public void SetData(int[] innerDropIds, int starNum)
    {
        ClearItems();

        for (int i = 0, j = innerDropIds.Length; i < j; i++)
        {
            foreach (int k in DataTemplate.GetInstance().m_InnerdropTable.GetDataKeys())
            {
                InnerdropTemplate _it = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(k);

                if (_it == null)
                {
                    continue;
                }

                if (_it.getInnerdropid() == innerDropIds[i])
                {
                    //Sprite icon = DynamicItem.GetSprite(_it.getObjectid());

                    //RewardBoxItemUI ui = GenerateItemUI(_it.getDropnum(), icon);
                    //if (ui != null)
                    //{
                    //    mItemsList.Add(ui);
                    //}

                    UniversalItemCell cell = UniversalItemCell.GenerateItem(mListTrans);
                    cell.InitByID(_it.getObjectid(), _it.getDropnum());
                    if (cell != null)
                    {
                        mItemsList.Add(cell);
                    }
                }
            }
        }

        mDetailTxt.ShowRichText(string.Format(GameUtils.getString("maoxianguanka7"), starNum));
    }
예제 #12
0
    /// <summary>
    /// 打开礼包物品显示窗口
    /// </summary>
    public void OnOpenLbItemWindow()
    {
        m_AwardWindow.SetActive(true);

        foreach (Transform child in m_itemParent.transform)
        {
            if (child.gameObject.name == "item(Clone)")
            {
                Destroy(child.gameObject);
            }
        }

        for (int j = 0; j < ObjectSelf.GetInstance().GetSettingData().m_innerdropidlist.Count; j++)
        {
            m_Cell = UniversalItemCell.GenerateItem(m_itemParent.transform);

            InnerdropTemplate value = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(ObjectSelf.GetInstance().GetSettingData().m_innerdropidlist[j]);
            if (value == null)
            {
                return;
            }

            int itemid = value.getObjectid();    //掉落物ID
            int type   = value.getObjectid() / 1000000;
            switch (type)
            {
            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES:
                ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid);
                if (_temp_res != null)
                {
                    m_Cell.InitByID(itemid, value.getDropnum());
                    m_Cell.SetText(GameUtils.getString(_temp_res.getName()), "", "");
                }
                break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE:         //符文
            {
                ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid);
                if (itemTable != null)
                {
                    m_Cell.InitByID(itemid, -1);
                    m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", "");
                }
            }
            break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON:
            {
                ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid);
                if (itemTable != null)
                {
                    m_Cell.InitByID(itemid, value.getDropnum());
                    m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", "");
                }
            }
            break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO:
            {
                HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(itemid);
                if (hero != null)
                {
                    m_Cell.InitByID(itemid, value.getDropnum());
                    m_Cell.SetText(GameUtils.getString(hero.getTitleID()), "", "");
                }
            }
            break;

            default:
                break;
            }
        }
    }
    private void GreatAwardItem(int _key, GameactivityTemplate _GameactivityTemplate, UniversalItemCell m_Cell)
    {
        int _num = -1;

        int[]    dropdestypeArray = _GameactivityTemplate.getDropdestype();
        string[] DropdesArray     = _GameactivityTemplate.getDropdes().Split('#');
        int[]    numdesArray      = _GameactivityTemplate.getNumdes();;
        string[] TextdesArray     = _GameactivityTemplate.getTextdes().Split('#');

        if (numdesArray.Length != 0)
        {
            if (numdesArray[0] != -1)
            {
                _num = numdesArray[_key];
            }
        }

        if (dropdestypeArray[_key] == 1)
        {
            int itemid = int.Parse(DropdesArray[_key]);

            int type = itemid / 1000000;

            switch (type)
            {
            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES:
                ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid);
                if (_temp_res != null)
                {
                    m_Cell.InitByID(itemid, _num);
                    m_Cell.SetText(GameUtils.getString(_temp_res.getName()), "", "");
                }
                break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE:     //符文
            {
                ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid);
                if (itemTable != null)
                {
                    m_Cell.InitByID(itemid, -1);
                    m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", "");
                }
            }
            break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON:
            {
                ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid);
                if (itemTable != null)
                {
                    m_Cell.InitByID(itemid, _num);
                    m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", "");
                }
            }
            break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO:
            {
                HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(itemid);
                if (hero != null)
                {
                    m_Cell.InitByID(itemid, _num);
                    m_Cell.SetText(GameUtils.getString(hero.getTitleID()), "", "");
                }
            }
            break;

            default:
                break;
            }
        }
        if (dropdestypeArray[_key] == 0)
        {
            m_Cell.SetText(GameUtils.getString(TextdesArray[_key]), "", "");
            Sprite sprite = UIResourceMgr.LoadSprite(common.defaultPath + TextdesArray[_key]);
            m_Cell.InitBySprite(sprite);
        }
    }
    private void GreatItem(int _key, GameactivityTemplate _GameactivityTemplate, ActivityOverviewData _ActivityOverviewData)
    {
        m_Cell = UniversalItemCell.GenerateItem(m_IconItemParent.transform);

        int _Daymax = _GameactivityTemplate.getDaymax();

        if (_Daymax == -1)
        {
            _Daymax = 1000000;
        }

        if (_ActivityOverviewData.m_todaynum < _Daymax)
        {
            m_Cell.SetCheckClaim(false, "");
        }
        else
        {
            if (_ActivityOverviewData.m_cangetnum == 0)
            {
                m_Cell.SetCheckClaim(true, "");
            }
            else
            {
                m_Cell.SetCheckClaim(false, "");
            }
        }

        int[]    dropdestypeArray = _GameactivityTemplate.getDropdestype();
        string[] DropdesArray     = _GameactivityTemplate.getDropdes().Split('#');
        int[]    numdesArray      = _GameactivityTemplate.getNumdes();;
        string[] TextdesArray     = _GameactivityTemplate.getTextdes().Split('#');

        int _num = -1;

        if (numdesArray.Length != 0)
        {
            if (numdesArray[_key] != -1)
            {
                _num = numdesArray[_key];
            }
        }

        if (dropdestypeArray[_key] == 1)
        {
            int itemid = int.Parse(DropdesArray[_key]);

            int type = itemid / 1000000;

            switch (type)
            {
            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES:
                ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid);
                if (_temp_res != null)
                {
                    m_Cell.InitByID(itemid, _num);
                    m_Cell.SetText(GameUtils.getString(_temp_res.getName()), "", "");
                }
                break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE:     //符文
            {
                ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid);
                if (itemTable != null)
                {
                    m_Cell.InitByID(itemid, -1);
                    m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", "");
                }
            }
            break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON:
            {
                ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid);
                if (itemTable != null)
                {
                    m_Cell.InitByID(itemid, _num);
                    m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", "");
                }
            }
            break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO:
            {
                HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(itemid);
                if (hero != null)
                {
                    m_Cell.InitByID(itemid, _num);
                    m_Cell.SetText(GameUtils.getString(hero.getTitleID()), "", "");
                }
            }
            break;

            default:
                break;
            }
        }
        if (dropdestypeArray[_key] == 0)
        {
            m_Cell.SetText(GameUtils.getString(TextdesArray[_key]), "", "");
            if (TextdesArray[_key] != string.Empty)
            {
                Sprite sprite = UIResourceMgr.LoadSprite(common.defaultPath + TextdesArray[_key]);
                m_Cell.InitBySprite(sprite);
            }
        }
    }
예제 #15
0
    public void Show(StageTemplate stageT)
    {
        if (stageT == null)
        {
            Debug.LogError("关卡数据为null");
            return;
        }

        mStageT = stageT;

        //-----------------星级----------------;
        StageData sd      = ObjectSelf.GetInstance().BattleStageData.GetStageDataByStageId(stageT.m_stageid);
        int       starNum = 0;

        if (sd != null)
        {
            starNum = sd.m_StageStar;
        }

        for (int i = 0; i < 3; i++)
        {
            StarImgs[i].gameObject.SetActive(i < starNum);
        }

        int stageNum  = StageModule.GetStageNumInChapter(stageT);
        int chapterId = StageModule.GetChapterinfoIdByStageId(stageT.GetID());

        m_ChapterNameTxt.text = string.Format(GameUtils.getString("chapter_title"), GameUtils.ConverIntToString(chapterId));
        m_StageNameTxt.text   = string.Format(GameUtils.getString("guanqia_mingzi"), stageNum, GameUtils.getString(stageT.m_stagename));
        m_StageDescTxt.text   = GameUtils.getString(stageT.m_stageinfo);

        m_ResourceCount1.text = stageT.m_playerexp.ToString();
        m_ResourceCount2.text = stageT.m_goldreward.ToString();

        if (stageT.m_expcrystal == -1)
        {
            ResouceObj3.SetActive(false);
        }
        else
        {
            ResouceObj3.SetActive(true);
            m_ResourceCount3.text = stageT.m_expcrystal.ToString();
        }

        EM_STAGE_DIFFICULTTYPE difficultType = StageModule.GetStageDifficultType(stageT);
        string difficultStr = "";

        switch (difficultType)
        {
        case EM_STAGE_DIFFICULTTYPE.NONE:
            break;

        case EM_STAGE_DIFFICULTTYPE.NORMAL:
            difficultStr = GameUtils.getString("chapter_difficult_type1");
            break;

        case EM_STAGE_DIFFICULTTYPE.HARD:
            difficultStr = GameUtils.getString("chapter_difficult_type2");
            break;

        case EM_STAGE_DIFFICULTTYPE.HARDEST:
            difficultStr = GameUtils.getString("chapter_difficult_type2");
            break;

        default:
            break;
        }

        //-------------------关卡挑战次数--------------------
        //无限制;
        if (stageT.m_limittime < 0)
        {
            SetRapidObjActive(false);
        }
        else
        {
            SetRapidObjActive(true);
            int remineTimes = Mathf.Max(0, stageT.m_limittime - sd.m_FightSum);

            TEXT_COLOR tc = TEXT_COLOR.WHITE;
            if (remineTimes > 0)
            {
                tc = TEXT_COLOR.WHITE;
                m_ResetBtn.gameObject.SetActive(false);
            }
            else
            {
                m_ResetBtn.gameObject.SetActive(true);
                tc = TEXT_COLOR.RED;
            }
            m_RemindTimeTxt.text = GameUtils.getString("fight_fightprepare_content3") + GameUtils.StringWithColor(remineTimes.ToString(), tc) + "/" + stageT.m_limittime;
        }

        m_DifficultTxt.text = difficultStr;

        //行动力不足颜色标红;
        if (isEnoughPow(mStageT))
        {
            m_ConsumeCountTxt.text = stageT.m_cost.ToString();
        }
        else
        {
            m_ConsumeCountTxt.text = GameUtils.StringWithColor(stageT.m_cost.ToString(), TEXT_COLOR.RED);
        }

        switch (stageT.m_winCondition)
        {
        case 1:
            m_SucessConditionTxt.text = "◆" + GameUtils.getString("System_setting_content28");
            break;

        case 2:
            m_SucessConditionTxt.text = "◆" + string.Format(GameUtils.getString("System_setting_content29"), StageModule.GetBossName(stageT));
            break;
        }
        //--------------------敌方英雄信息------------------;
        for (int i = 0; i < mEnermyList.Count; i++)
        {
            if (mEnermyList[i] != null)
            {
                mEnermyList[i].Destroy();
            }
        }
        mEnermyList.Clear();

        List <MonsterTemplate> _BossTemp    = new List <MonsterTemplate>();
        List <MonsterTemplate> _MonsterTemp = new List <MonsterTemplate>();

        for (int i = 0, j = stageT.m_displayMonster.Length; i < j; i++)
        {
            MonsterTemplate _monster = (MonsterTemplate)DataTemplate.GetInstance().m_MonsterTable.getTableData(stageT.m_displayMonster[i]);
            if (_monster.getMonstertype() == 2)
            {
                _BossTemp.Add(_monster);
            }
            else
            {
                _MonsterTemp.Add(_monster);
            }
        }

        for (int i = 0; i < _BossTemp.Count; ++i)
        {
            UniversalItemCell cell = UniversalItemCell.GenerateItem(EnermyListTrans);
            cell.InitByID(_BossTemp[i].getId());
            cell.SetSize(UniversalItemCell.UniversalItemSize.Type_114);
            cell.SetCount("BOSS");
            cell.AddClickListener(OnClickUniversalHeroHandler);
            mEnermyList.Add(cell);
        }

        for (int i = 0; i < _MonsterTemp.Count; i++)
        {
            UniversalItemCell cell = UniversalItemCell.GenerateItem(EnermyListTrans);
            cell.InitByID(_MonsterTemp[i].getId());
            cell.SetSize(UniversalItemCell.UniversalItemSize.Type_114);
            cell.AddClickListener(OnClickUniversalHeroHandler);
            //cell.SetCount("BOSS");
            mEnermyList.Add(cell);
        }

        //--------------------关卡掉落展示------------------;
        for (int i = 0; i < mItemsList.Count; i++)
        {
            if (mItemsList[i] != null)
            {
                mItemsList[i].Destroy();
            }
        }
        mItemsList.Clear();

        string displaydrop = stageT.m_displaydrop;

        if (displaydrop == "-1" || string.IsNullOrEmpty(displaydrop))
        {
        }
        else
        {
            string[] displaydropList = displaydrop.Split('#');
            if (displaydropList.Length == 0)
            {
                return;
            }

            for (int i = 0; i < displaydropList.Length; i++)
            {
                UniversalItemCell cell = UniversalItemCell.GenerateItem(ItemListTrans);
                cell.SetSize(UniversalItemCell.UniversalItemSize.Type_114);
                cell.AddClickListener(OnClickUniversalItemHandler);
                string[] itemList = displaydropList[i].Split('-');
                switch (int.Parse(itemList[0]))
                {
                case 1:
                    int itemid = int.Parse(itemList[1]);
                    if (int.Parse(itemList[2]) == 0)
                    {
                        //几率掉落;
                        cell.InitByID(itemid);
                        cell.SetText(null, GameUtils.getString("fight_stageselect_content3"), null);
                    }
                    else
                    {
                        //一定掉落;
                        int count = System.Convert.ToInt32(itemList[3]);
                        cell.InitByID(itemid, count);
                    }
                    break;

                case 2:
                    if (int.Parse(itemList[2]) == 0)
                    {
                        cell.InitBySprite(UIResourceMgr.LoadSprite(common.defaultPath + itemList[1]));
                        cell.SetText(null, GameUtils.getString("fight_stageselect_content3"), null);
                    }
                    else
                    {
                        int count = System.Convert.ToInt32(itemList[3]);
                        cell.InitBySprite(UIResourceMgr.LoadSprite(common.defaultPath + itemList[1]), count);
                    }
                    break;

                default:
                    break;
                }

                mItemsList.Add(cell);
            }
        }
    }
예제 #16
0
    private void UpdateAwardItem(int index, RectTransform cell)
    {
        m_Cell = cell.GetComponent <UniversalItemCell>();

        InnerdropTemplate value = mDropList[index] as InnerdropTemplate;

        if (value == null)
        {
            return;
        }
        int itemid = value.getObjectid();

        int type = itemid / 1000000;

        switch (type)
        {
        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES:
            ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid);
            if (_temp_res != null)
            {
                m_Cell.InitByID(itemid, value.getDropnum());
                m_Cell.SetText(GameUtils.getString(_temp_res.getName()), "", "");
            }
            break;

        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE:     //符文
        {
            ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(value.getObjectid());
            if (itemTable != null)
            {
                m_Cell.InitByID(itemid, -1);
                m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", "");
            }
        }
        break;

        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON:
        {
            ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(value.getObjectid());
            if (itemTable != null)
            {
                m_Cell.InitByID(itemid, value.getDropnum());
                m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", "");
            }
        }
        break;

        case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO:
        {
            HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(value.getObjectid());
            if (hero != null)
            {
                m_Cell.InitByID(itemid, value.getDropnum());
                m_Cell.SetText(GameUtils.getString(hero.getTitleID()), "", "");
            }
        }
        break;

        default:
            break;
        }
        //UI_LivenessDropItem _UI_LivenessDropItem = cell.GetComponent<UI_LivenessDropItem>();
        //if (_UI_LivenessDropItem == null)
        //{
        //    _UI_LivenessDropItem = cell.gameObject.AddComponent<UI_LivenessDropItem>();
        //}
        //_UI_LivenessDropItem.Data(mDropList[index]);
    }
예제 #17
0
    public void ShowInnerDrop(List <int> innerdropIDList)
    {
        for (int i = 0; i < innerdropIDList.Count; i++)
        {
            UniversalItemCell m_Cell = UniversalItemCell.GenerateItem(listObj.transform);

            InnerdropTemplate value = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(innerdropIDList[i]);
            if (value == null)
            {
                return;
            }

            int itemid = value.getObjectid();//掉落物ID
            int type   = value.getObjectid() / 1000000;
            m_Cell.AddClickListener(OnItemClick);

            switch (type)
            {
            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES:
                ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid);
                if (_temp_res != null)
                {
                    m_Cell.InitByID(itemid, value.getDropnum());
                    m_Cell.SetText(GameUtils.getString(_temp_res.getName()), "", "");
                }
                break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE:     //符文
            {
                ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid);
                if (itemTable != null)
                {
                    m_Cell.InitByID(itemid, -1);
                    m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", "");
                }
            }
            break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON:
            {
                ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid);
                if (itemTable != null)
                {
                    m_Cell.InitByID(itemid, value.getDropnum());
                    m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", "");
                }
            }
            break;

            case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO:
            {
                HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(itemid);
                if (hero != null)
                {
                    m_Cell.InitByID(itemid, value.getDropnum());
                    m_Cell.SetText(GameUtils.getString(hero.getTitleID()), "", "");
                }
            }
            break;

            default:
                break;
            }
        }
    }
예제 #18
0
        //public bool isReward(int difficulttype, int rewardnum)
        //{
        //    int reward = 0;
        //    if (difficulttype == 1)
        //    {
        //        reward = rewardnum % 10;
        //    }
        //    else if (difficulttype == 2)
        //    {
        //        reward = rewardnum % 100 / 10;
        //    }
        //    else if (difficulttype == 3)
        //    {
        //        reward = rewardnum / 100;
        //    }
        //    return reward != 0;
        //}

        public void UpdateShow()
        {
            //Debug.Log(mGrid.transform.position);
            //mGrid.transform.position = new Vector3(-225.4f, -4.7f, -263.4f);
            //与服务器交互显示所得物品
            //UI_SelectFightArea sfight = UI_SelectFightArea.Inst;
            int chapterId   = ObjectSelf.GetInstance().GetCurChapterID();
            int difficultLv = ObjectSelf.GetInstance().CurChapterLevel;
            ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(chapterId);

            if (chapterT != null)
            {
                int total    = 0;
                int curstart = 0;

                StageModule.GetCurTotalStarsCount(chapterT, (EM_STAGE_DIFFICULTTYPE)difficultLv, out curstart, out total);

                if (curstart >= total)
                {
                    //TODO 宝箱弹窗
                    //if (isReward(difficultLv, sfight.iTotalCharpter[sfight.iChapterID].m_bRewardGot))
                    if (StageModule.isReward(difficultLv, ObjectSelf.GetInstance().BattleStageData.GetRewardGot(chapterId)))
                    {
                        mHeader.text = GameUtils.getString("fight_bosbox_content");
                        mCloseImage.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "Ui_xuanze");
                        //mCloseText.text = "关  闭";
                        mCloseText.text = GameUtils.getString("common_button_close");
                    }
                    else
                    {
                        mHeader.text = GameUtils.getString("sign_content5");
                        mCloseImage.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "Ui_xuanze");
                        //mCloseText.text = "领  取";
                        mCloseText.text = GameUtils.getString("common_button_receive");
                    }
                }
                else
                {
                    mHeader.text = GameUtils.getString("fight_bosbox_content");
                    mCloseImage.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "Ui_xuanze");
                    //mCloseText.text = "关  闭";
                    mCloseText.text = GameUtils.getString("common_button_close");
                }
                innerdropIDList.Clear();
                //int[] chapterDropList = ((ChapterinfoTemplate)DataTemplate.GetInstance().m_ChapterTable.getTableData(sfight.iChapterID)).getChapterDrop();
                //int chapterDropID = chapterDropList[difficultLv - 1];
                //int[] innerdropList = ((NormaldropTemplate)DataTemplate.GetInstance().m_NormaldropTable.getTableData(chapterDropID)).getInnerdrop();
                //Dictionary<int, IExcelBean> innerIExcel = DataTemplate.GetInstance().m_InnerdropTable.getData();
                ////List<InnerdropTemplate> innerdropIDList = new List<InnerdropTemplate>();
                //for (int i = 0; i < innerdropList.Length; i++)
                //{
                //    foreach (var item in innerIExcel.Values)
                //    {
                //        if (((InnerdropTemplate)item).getInnerdropid() == innerdropList[i])
                //        {
                //            innerdropIDList.Add((InnerdropTemplate)item);
                //        }
                //    }
                //}

                //ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(ObjectSelf.GetInstance().GetCurChapterID());
                //if (chapterT == null)
                //{
                //    LogSystem.LogManager.LogToFile("战斗奖励界面失败---ChapterinfoTemplate is NULL. id=" + chapterId);
                //    return;
                //}
                int dropId = difficultLv - 1;

                if (chapterT.getChapterDrop().Length <= 0)
                {
                    LogSystem.LogManager.LogToFile("战斗奖励界面失败---ChapterinfoTemplate 中章节掉落包数组是空的. id=" + chapterId);
                    return;
                }

                int chapterDropId          = chapterT.getChapterDrop()[dropId];
                NormaldropTemplate normalT = DataTemplate.GetInstance().GetNormaldropTemplateById(chapterDropId);
                if (normalT == null)
                {
                    LogSystem.LogManager.LogToFile("战斗奖励界面失败---ChapterinfoTemplate is NULL. id=" + chapterDropId);
                    return;
                }
                int[] innerDropList = normalT.getInnerdrop();
                for (int i = 0, j = innerDropList.Length; i < j; i++)
                {
                    foreach (int k in DataTemplate.GetInstance().m_InnerdropTable.GetDataKeys())
                    {
                        InnerdropTemplate _it = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(k);

                        if (_it == null)
                        {
                            continue;
                        }

                        if (_it.getInnerdropid() == innerDropList[i])
                        {
                            innerdropIDList.Add(k);
                        }
                    }
                }
            }
            //char[] sfightList = sfight.iTotalCharpter[sfight.iChapterID].m_bRewardGot.ToString().ToCharArray();
            else
            {
                mCloseImage.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "Ui_xuanze");
                //mCloseText.text = "关  闭";
                mCloseText.text = GameUtils.getString("common_button_close");
                for (int i = 0; i < UI_SacredAltar._instance.m_FallItemList.Count; i++)
                {
                    //InnerdropTemplate item = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(UI_SacredAltar._instance.m_FallItemList[i]);
                    //InnerdropTemplate item = DataTemplate.GetInstance().GetInnerdropTemplateById(UI_SacredAltar._instance.m_FallItemList[i]);
                    innerdropIDList.Add(UI_SacredAltar._instance.m_FallItemList[i]);
                }
            }

            for (int i = 0; i < innerdropIDList.Count; i++)
            {
                m_Cell = UniversalItemCell.GenerateItem(mGrid.transform);

                InnerdropTemplate value = (InnerdropTemplate)DataTemplate.GetInstance().m_InnerdropTable.getTableData(innerdropIDList[i]);
                if (value == null)
                {
                    return;
                }

                int itemid = value.getObjectid();//掉落物ID
                int type   = value.getObjectid() / 1000000;
                m_Cell.AddClickListener(ShowItemPreviewUIHandler);

                switch (type)
                {
                case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RES:
                    ResourceindexTemplate _temp_res = (ResourceindexTemplate)DataTemplate.GetInstance().m_ResourceindexTemplate.getTableData(itemid);
                    if (_temp_res != null)
                    {
                        m_Cell.InitByID(itemid, value.getDropnum());
                        m_Cell.SetText(GameUtils.getString(_temp_res.getName()), "", "");
                    }
                    break;

                case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_RUNE:     //符文
                {
                    ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid);
                    if (itemTable != null)
                    {
                        m_Cell.InitByID(itemid, -1);
                        m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", "");
                    }
                }
                break;

                case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_COMMON:
                {
                    ItemTemplate itemTable = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(itemid);
                    if (itemTable != null)
                    {
                        m_Cell.InitByID(itemid, value.getDropnum());
                        m_Cell.SetText(GameUtils.getString(itemTable.getName()), "", "");
                    }
                }
                break;

                case (int)EM_OBJECT_CLASS.EM_OBJECT_CLASS_HERO:
                {
                    HeroTemplate hero = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(itemid);
                    if (hero != null)
                    {
                        m_Cell.InitByID(itemid, value.getDropnum());
                        m_Cell.SetText(GameUtils.getString(hero.getTitleID()), "", "");
                    }
                }
                break;

                default:
                    break;
                }
            }
        }
예제 #19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="go">预制件</param>
 /// <param name="tittleImage">需要切换的标题精灵图片(图片顺序:已经领取\今天\未领取)</param>
 public SignInCellData(Transform layout)
 {
     m_Cell = UniversalItemCell.GenerateItem(layout);
 }