Esempio n. 1
0
        /// <summary>
        /// 通过[ID]二分快速查表
        /// </summary>
        /// <param name="ID">ID</param>
        /// <returns></returns>
        public static HuntingDataBase Query(this List <HuntingDataBase> sorted, uint ID)
        {
            var key = new HuntingDataBase()
            {
                ID = ID
            };
            var comparer = new Comparer1();
            var index    = sorted.BinarySearch(key, comparer);

            return(index >= 0 ? sorted[index] : default(HuntingDataBase));
        }
Esempio n. 2
0
 void onClick_DropBtn_Btn(HuntingDataBase data)
 {
     AddCreator(m_trans_RewardRoot);
     m_lst_UIItemRewardDatas.Clear();
     string[] items = data.dropItem.Split('_');
     for (int i = 0; i < items.Length; i++)
     {
         uint itemID = uint.Parse(items[i]);
         m_lst_UIItemRewardDatas.Add(new UIItemRewardData()
         {
             itemID = itemID,
             num    = 1,
         });
     }
     m_ctor_UIItemRewardCreator.CreateGrids(m_lst_UIItemRewardDatas.Count);
 }
Esempio n. 3
0
 void OnHuntingGridUpdate(UIGridBase grid, int index)
 {
     if (grid is UIHuntingListGrid)
     {
         HuntingDataBase data = huntingDataList[index];
         if (data != null)
         {
             UIHuntingListGrid listGrid = grid as UIHuntingListGrid;
             listGrid.SetGridData(data);
             listGrid.SetHightLight(false);
         }
     }
     if (grid is UITabGrid)
     {
         UITabGrid g = grid as UITabGrid;
         g.SetName(toggleDic[(uint)index + 1]);
         g.TabID = index + 1;
     }
 }
Esempio n. 4
0
    void onClickHuntingGrid(HuntingDataBase huntDa)
    {
        HuntingDataBase data = huntDa;

        MonsterID = data.ID;
        DataManager.Manager <HuntingManager>().MonsterID = MonsterID;
        if (boss_dic.Count > 0 && boss_dic.ContainsKey(MonsterID))
        {
            NpcDataBase monster = GameTableManager.Instance.GetTableItem <NpcDataBase>(boss_dic[MonsterID].boss_npc_id);
            if (monster != null)
            {
                m_label_BossName.text = monster.strName;
                MapDataBase map = GameTableManager.Instance.GetTableItem <MapDataBase>(data.mapID);
                m_label_mapLabel.text = map.strName;
            }
        }
        ShowModel(data);
        onClick_DropBtn_Btn(data);
        m_label_LieHunNum.text = data.HuntingScore.ToString();
    }
Esempio n. 5
0
    void ShowModel(HuntingDataBase data)
    {
        string[] monID     = data.monsterID.Split('_');
        uint     monsterid = uint.Parse(monID[0]);

        table.NpcDataBase npcData = GameTableManager.Instance.GetTableItem <NpcDataBase>(monsterid);
        if (npcData != null)
        {
            uint modelID = npcData.dwViewModelSet;  // 使用观察模型
            if (m_RTObj != null)
            {
                m_RTObj.Release();
                m_RTObj = null;
            }

            m_RTObj = DataManager.Manager <RenderTextureManager>().CreateRenderTextureObj((int)modelID, 800);
            if (m_RTObj == null)
            {
                return;
            }
            ModeDiplayDataBase modelDisp = GameTableManager.Instance.GetTableItem <ModeDiplayDataBase>(modelID);
            if (modelDisp == null)
            {
                Engine.Utility.Log.Error("BOSS模型ID为{0}的模型展示数据为空", modelID);
                return;
            }
            m_RTObj.SetDisplayCamera(modelDisp.pos800, modelDisp.rotate800, modelDisp.Modelrotation);
            m_RTObj.PlayModelAni(Client.EntityAction.Stand);
            UIRenderTexture rt = m__Model.GetComponent <UIRenderTexture>();
            if (null == rt)
            {
                rt = m__Model.gameObject.AddComponent <UIRenderTexture>();
            }
            if (null != rt)
            {
                rt.SetDepth(3);
                rt.Initialize(m_RTObj, m_RTObj.YAngle, new UnityEngine.Vector2(800, 800));
            }
        }
    }
Esempio n. 6
0
    void SetActiveMonsterGrid(uint monsterID, bool needFocus = true)
    {
        if (m_ctor_ListScrollView != null)
        {
            UIHuntingListGrid monGrid = m_ctor_ListScrollView.GetGrid <UIHuntingListGrid>(monsterIDs.IndexOf(defaultMonsterID));
            if (null != monGrid)
            {
                monGrid.SetHightLight(false);
            }
            if (needFocus)
            {
                m_ctor_ListScrollView.FocusGrid(monsterIDs.IndexOf(monsterID));
            }
            monGrid = m_ctor_ListScrollView.GetGrid <UIHuntingListGrid>(monsterIDs.IndexOf(monsterID));
            if (monGrid != null)
            {
                monGrid.SetHightLight(true);
            }
            defaultMonsterID = monsterID;

            HuntingDataBase data = huntingDataList[monsterIDs.IndexOf(monsterID)];
            onClickHuntingGrid(data);
        }
    }
Esempio n. 7
0
    public override void SetGridData(object data)
    {
        base.SetGridData(data);
        if (null == data)
        {
            return;
        }
        this.huntingdata = data as HuntingDataBase;
        MonsterID        = huntingdata.ID;
        level.text       = huntingdata.level.ToString();
        if (null != icon)
        {
            UIManager.GetTextureAsyn(huntingdata.icon, ref m_iconCASD, () =>
            {
                if (null != icon)
                {
                    icon.mainTexture = null;
                }
            }, icon);
        }
        //刷新时间
        uint boss_index = huntingdata.ID;

        if (boss_dic.Count > 0)
        {
            string      msg  = "";
            TextManager tMgr = DataManager.Manager <TextManager>();
            if (boss_dic.ContainsKey(boss_index))
            {
                BossRefreshInfo info = boss_dic[boss_index];
                if (info.boss_state == (uint)BossState.BossState_Live)
                {
                    msg = tMgr.GetLocalText(LocalTextType.HuntingBoss_YiShuaXin);
                }
                //击杀中
                else if (info.boss_state == (uint)BossState.BossState_Attacted)
                {
                    msg = tMgr.GetLocalText(LocalTextType.HuntingBoss_GongJiZhong);
                }
                else if (info.boss_state == (uint)BossState.BossState_Die)
                {
                    DateTime dt = SetTime(info.remaintime);
                    msg = tMgr.GetLocalFormatText(LocalTextType.HuntingBoss_ShuaXinShiJian, string.Format("{0:d2}", dt.Hour) + ":" + string.Format("{0:d2}", dt.Minute));
                }
                else if (info.boss_state == (uint)BossState.BossState_Rest)
                {
                    msg = tMgr.GetLocalText(LocalTextType.HuntingBoss_YiXiuXi);
                }

                NpcDataBase monster = GameTableManager.Instance.GetTableItem <NpcDataBase>(info.boss_npc_id);
                if (monster != null)
                {
                    name.text = monster.strName;
                }
                else
                {
                    Engine.Utility.Log.Error("NPC表格中找不到ID为{0}的怪物,请确认表格或者重新打表", info.boss_npc_id);
                }

                m_lab_bossState.text = msg;
            }
        }
    }