Example #1
0
        private void InitMap()
        {
            Dictionary <int, LTInstanceNode> dataDic = LTInstanceMapModel.Instance.NodeDataHashDic;

            if (dataDic == null)
            {
                return;
            }
            List <LTInstanceNode> dataList = new List <LTInstanceNode>();

            int HeightCount = 4;
            int WidthCount  = 5;
            int yMax        = LTInstanceMapModel.Instance.CurNode.y + HeightCount;
            int xMax        = LTInstanceMapModel.Instance.CurNode.x + WidthCount;

            for (int y = LTInstanceMapModel.Instance.CurNode.y - HeightCount; y <= yMax; y++)
            {
                int hash_1 = y * 100;
                for (int x = LTInstanceMapModel.Instance.CurNode.x - WidthCount; x < xMax; x++)
                {
                    int            hash = hash_1 + x;
                    LTInstanceNode cell;
                    if (dataDic.TryGetValue(hash, out cell))
                    {
                        if (!cell.CanPass)
                        {
                            continue;
                        }
                        dataList.Add(cell);
                    }
                }
            }

            if (dataList == null || dataList.Count < 0)
            {
                return;
            }

            for (var i = 0; i < dataList.Count; ++i)
            {
                var node = dataList[i];
                LTInstanceRowCtrl row = null;
                if (rowCtrlDic.TryGetValue(node.y, out row))
                {
                    LTInstanceNodeTemp cell = null;
                    if (row.itemObjDic.TryGetValue(node.x, out cell))
                    {
                        cell.UpdateData(node);
                    }
                    else
                    {
                        row.CreateNodeFromCache(node);
                    }
                }
                else
                {
                    CreateRow(node);
                }
            }
        }
Example #2
0
        public void CreateNodeFromCache(LTInstanceNode data)
        {
            if (data == null)
            {
                EB.Debug.LogError("CreateNodeFromCache===>data is null!");
                return;
            }

            GameObject         obj  = null;
            LTInstanceNodeTemp temp = null;

            if (IsSmallMap)
            {
                if (data.Type == LTInstanceNode.NodeType.WALL)
                {
                    obj = GameObject.Instantiate(Wall, mDMono.transform);
                }
                else if (data.Type == LTInstanceNode.NodeType.Floor)
                {
                    obj = GameObject.Instantiate(Floor, mDMono.transform);
                }
                temp = obj.GetMonoILRComponent <LTInstanceNodeTemp>();
            }
            else
            {
                if (data.Type == LTInstanceNode.NodeType.WALL)
                {
                    //GetOneWall(st_CacheWall, st_CacheWall_Comp, out obj, out temp);
                    obj = GameObject.Instantiate(Wall, mDMono.transform);
                    obj.CustomSetActive(true);
                    temp = obj.GetMonoILRComponent <LTInstanceNodeTemp>();
                }
                else if (data.Type == LTInstanceNode.NodeType.Floor)
                {
                    //GetOneFloor(st_CacheFloor, st_CacheFloor_Comp, out obj, out temp);
                    obj = GameObject.Instantiate(Floor, mDMono.transform);
                    obj.CustomSetActive(true);
                    temp = obj.GetMonoILRComponent <LTInstanceNodeTemp>();
                }
            }

            obj.CustomSetActive(true);
            if (IsSmallMap)
            {
                obj.transform.localPosition = new Vector3(data.x * LTInstanceConfig.SMALL_MAP_SCALE_X, data.x * LTInstanceConfig.SMALL_MAP_SCALE_Y, 0);
            }
            else
            {
                obj.transform.localPosition = new Vector3(data.x * LTInstanceConfig.MAP_X, data.x * LTInstanceConfig.MAP_Y, data.x * LTInstanceConfig.MAP_XZ);
            }
            obj.transform.localScale = Vector3.one;
            obj.name = data.x.ToString();
            //----
            temp.MapCtrl = MapCtrl;
            temp.SetData(data.x, data);
            itemObjDic[data.x] = temp;
        }
Example #3
0
        private void OpenBox(object data, int x, int y)
        {
            ArrayList list = data as ArrayList;

            if (list != null)
            {
                List <LTShowItemData> gamList = new List <LTShowItemData>();
                for (var i = 0; i < list.Count; ++i)
                {
                    var    item = list[i];
                    string type = EB.Dot.String("type", item, string.Empty);
                    string id   = EB.Dot.String("data", item, string.Empty);
                    int    num  = EB.Dot.Integer("quantity", item, 0);
                    if (list.Count == 1 && (type == LTShowItemType.TYPE_RES || type == LTShowItemType.TYPE_HEROSHARD || id == LTDrawCardConfig.LOTTERY_GOLD_ID || id == LTDrawCardConfig.LOTTERY_HC_ID || type == LTShowItemType.TYPE_ACTIVITY))
                    {
                        if (id == LTDrawCardConfig.LOTTERY_GOLD_ID || id == LTDrawCardConfig.LOTTERY_HC_ID || type == LTShowItemType.TYPE_HEROSHARD || id == LTResID.HcName)
                        {
                            FusionAudio.PostEvent("UI/New/ZuanShi", true);//获取抽奖券、碎片、钻石时播放
                        }
                        else if (id == LTResID.GoldName)
                        {
                            FusionAudio.PostEvent("UI/New/Coin", true);//获得金币时播放
                        }
                        else if (id == LTResID.BuddyExpName)
                        {
                            FusionAudio.PostEvent("UI/New/YaoShui", true);//获得伙伴经验时播放
                        }
                        LTIconNameQuality icon_name_lvl = LTItemInfoTool.GetInfo(id, type);
                        MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, string.Format(EB.Localizer.GetString("ID_codefont_in_LTChallengeInstanceHudController_20066"), icon_name_lvl.name, num));
                        continue;
                    }
                    LTShowItemData itemData = new LTShowItemData(id, num, type);
                    gamList.Add(itemData);
                }

                if (gamList.Count > 0)
                {
                    FusionAudio.PostEvent("UI/New/BaoXiang", true);
                    LTInstanceNodeTemp temp = MapCtrl.GetNodeObjByPos(x, y);
                    if (temp != null)
                    {
                        //首领宝箱奖励
                        var floor = temp as Instance.LTInstanceFloorTemp;
                        if (floor != null && floor.hasOtherModel())
                        {
                            //宝箱表现!
                            floor.ShowBossRewardFX(gamList, UICamera.mainCamera.WorldToScreenPoint(FlyScrollObj.transform.position));
                            return;
                        }
                    }
                    //普通宝箱奖励
                    GlobalMenuManager.Instance.Open("LTShowBoxView", gamList);
                }
            }
        }
Example #4
0
        private void InitMap()
        {
            Dictionary <int, LTInstanceNode> dataDic = LTInstanceMapModel.Instance.NodeDataHashDic;

            if (dataDic == null)
            {
                return;
            }
            List <LTInstanceNode> dataList = new List <LTInstanceNode>();

            foreach (var it in dataDic)
            {
                dataList.Add(it.Value);
            }

            if (dataList == null || dataList.Count < 0)
            {
                return;
            }

            for (var i = 0; i < dataList.Count; ++i)
            {
                var node = dataList[i];
                if (!node.CanPass)
                {
                    continue;
                }
                LTInstanceRowCtrl row = null;
                if (rowCtrlDic.TryGetValue(node.y, out row))
                {
                    LTInstanceNodeTemp cell = null;
                    if (row.itemObjDic.TryGetValue(node.x, out cell))
                    {
                        cell.UpdateData(node);
                    }
                    else
                    {
                        row.CreateNodeFromCache(node);
                    }
                }
                else
                {
                    CreateRow(node);
                }
            }
        }