Beispiel #1
0
        //

        private void get_lvl_info_res(Variant msgData)
        {
            int levelId; MapData mapdata;
            int res = msgData["res"];

            if (res < 0)
            {
                Globle.err_output(res);
                return;
            }
            debug.Log("KKKKKKKK" + msgData.dump());
            // debug.Log("<color=#00ff00>"+ msgData.dump() +"</color>");
            MapModel m = MapModel.getInstance();
            MapData  d;

            switch (res)
            {
            case 1:    //表示请求副本信息的结果
                       //int time = -1;

                //if (msgData.ContainsKey("refresh_time_left"))
                //   time = msgData["refresh_time_left"];

                int maxid0 = 0;
                int maxid1 = 0;
                //m.beginTimer = time + Time.time;
                if (msgData.ContainsKey("lvls"))
                {
                    List <Variant> lv = msgData["lvls"]._arr;

                    foreach (Variant v in lv)
                    {
                        d = m.getMapDta(v["lvlid"]);
                        if (d == null)
                        {
                            d = new MapData();
                        }

                        d.starNum = v["score"];

                        if (v.ContainsKey("last_enter_time"))
                        {
                            d.enterTime = v["last_enter_time"];
                        }
                        if (v.ContainsKey("enter_times"))
                        {
                            d.cycleCount = v["enter_times"];
                        }
                        if (v.ContainsKey("limit_tm"))
                        {
                            d.limit_tm = v["limit_tm"];
                        }
                        if (v.ContainsKey("vip_cnt"))
                        {
                            d.vip_buycount = v["vip_cnt"];
                        }
                        m.AddMapDta(v["lvlid"], d);
                        d = m.getMapDta(v["lvlid"]);
                        if (d.type == 1)
                        {
                            if (d.starNum > 0 && d.id > maxid0)
                            {
                                maxid0 = d.id;
                            }
                        }
                        else if (d.type == 2)
                        {
                            if (d.starNum > 0 && d.id > maxid1)
                            {
                                maxid1 = d.id;
                            }
                        }
                        //if (v["lvlid"] == 104)
                        //{
                        //    if (v.ContainsKey ("diff_lvl"))
                        //    {
                        //        A3_ActiveModel.getInstance().nowlvl = v["diff_lvl"];
                        //    }
                        //}
                    }

                    m.setLastMapId(0, maxid0);
                    m.setLastMapId(1, maxid1);

                    m.inited = true;
                }

                if (msgData.ContainsKey("mlzd_info"))
                {
                    Variant mlzd = msgData["mlzd_info"];
                    if (mlzd.ContainsKey("mlzd_diff"))
                    {
                        A3_ActiveModel.getInstance().maxlvl = mlzd["mlzd_diff"];
                    }

                    if (mlzd.ContainsKey("diff_floor"))
                    {
                        A3_ActiveModel.getInstance().nowlvl = mlzd["diff_floor"];
                    }
                    if (mlzd.ContainsKey("times"))
                    {
                        A3_ActiveModel.getInstance().count_mlzd = mlzd["times"];
                    }
                    if (mlzd.ContainsKey("sweep_type"))
                    {
                        A3_ActiveModel.getInstance().sweep_type = mlzd["sweep_type"];
                    }

                    if (mlzd.ContainsKey("tm"))
                    {
                        A3_ActiveModel.getInstance().Time = mlzd["tm"];
                    }
                    if (a3_active_mlzd.instans != null)
                    {
                        a3_active_mlzd.instans.RefreshLeftTimes();
                    }
                }

                MapModel mapM = MapModel.getInstance();
                //凌晨界面打开时数据要刷新(单/组队人副本)
                if (a3_counterpart._instance)
                {
                    a3_counterpart._instance.refreshGoldTimes();
                    a3_counterpart._instance.refreshExpTimes();
                    a3_counterpart._instance.refreshMateTimes();
                }
                break;

            case 2:    // <!--扫荡了多少次,客户端按此值对rewards数组进行分组-->

                levelId       = msgData["lvlid"];
                mapdata       = MapModel.getInstance().getMapDta(levelId);
                mapdata.count = msgData["left_times"];
                List <Variant> rewards = msgData["rewards"]._arr;

                int len = rewards.Count / 3;
                int idx = 0;
                List <List <MapItemData> > ll = new List <List <MapItemData> >();
                List <MapItemData>         l;
                MapItemData mapitemdata;
                for (int i = 0; i < len; i++)
                {
                    l = new List <MapItemData>();
                    for (int j = 0; j < 3; j++)
                    {
                        mapitemdata       = new MapItemData();
                        mapitemdata.id    = rewards[idx]["tpid"];
                        mapitemdata.count = rewards[idx]["cnt"];
                        l.Add(mapitemdata);
                        idx++;
                    }
                    ll.Add(l);
                }

                //fb_wipeout.showIt(ll, mapdata);
                break;

            case 3:    // <!--3表示重置副本-->
                levelId            = msgData["lvlid"];
                mapdata            = MapModel.getInstance().getMapDta(levelId);
                mapdata.count      = msgData["left_times"];
                mapdata.resetCount = msgData["left_reset_times"];

                //if (fb_info.instance != null)
                //    fb_info.instance.onRefresh(levelId);
                break;

            case 4:    // <!--4表示有新的最高分产生,同步给客户端-->
                int id = msgData["lvlid"];
                if (id == 104)
                {
                    if (msgData.ContainsKey("mlzd_diff"))
                    {
                        A3_ActiveModel.getInstance().maxlvl = msgData["mlzd_diff"];
                    }

                    if (msgData.ContainsKey("diff_floor"))
                    {
                        A3_ActiveModel.getInstance().nowlvl = msgData["diff_floor"];
                    }
                }
                if (m.containerID(id))
                {
                    break;
                }

                d = m.getMapDta(id);
                if (d == null)
                {
                    return;
                }
                d.starNum    = msgData["score"];
                d.count      = msgData["left_times"];
                d.resetCount = msgData["left_reset_times"];



                break;

            //vip购买增加次数返回
            case 5:

                MapData data = m.getMapDta(msgData["ltpid"]);
                if (data == null)
                {
                    data = new MapData();
                    data.vip_buycount = msgData["vip_cnt"];
                    MapModel.getInstance().AddMapDta(msgData["ltpid"], data);
                }
                else
                {
                    MapModel.getInstance().dFbDta[msgData["ltpid"]].vip_buycount = msgData["vip_cnt"];
                }

                if (a3_counterpart._instance)
                {
                    a3_counterpart._instance.refreshGoldTimes();
                    a3_counterpart._instance.refreshExpTimes();
                    a3_counterpart._instance.refreshMateTimes();
                }



                //MJJDModel.getInstance().GetBuyRefresh(msgData);
                break;

            case 6:
                //MJJDModel.getInstance().GetMJJDTimes(msgData);
                break;

            case 7:    //刷新墨家境地波数
                //if (float_mjjd.instance != null && msgData.ContainsKey("current_wave"))
                //    float_mjjd.instance.refreshBo(msgData["current_wave"]);
                break;

            default:
                break;
            }


            //NetClient.instance.dispatchEvent(
            //     GameEvent.Create(PKG_NAME.S2C_GET_LVL_INFO_RES, this, GameTools.CreateSwitchData("get_lvl_info_res", msgData))
            // );
            //GameSession(this.session).logicClient.logicInGame.lgGD_levels.get_lvl_info_res(msgData);
        }
Beispiel #2
0
        private void get_lvl_info_res(Variant msgData)
        {
            int  num  = msgData["res"];
            bool flag = num < 0;

            if (flag)
            {
                Globle.err_output(num);
            }
            else
            {
                debug.Log("KKKKKKKK" + msgData.dump());
                MapModel instance = MapModel.getInstance();
                switch (num)
                {
                case 1:
                {
                    int  num2  = 0;
                    int  num3  = 0;
                    bool flag2 = msgData.ContainsKey("lvls");
                    if (flag2)
                    {
                        List <Variant> arr = msgData["lvls"]._arr;
                        foreach (Variant current in arr)
                        {
                            MapData mapData = instance.getMapDta(current["lvlid"]);
                            bool    flag3   = mapData == null;
                            if (flag3)
                            {
                                mapData = new MapData();
                            }
                            instance.AddMapDta(current["lvlid"], mapData);
                            mapData         = instance.getMapDta(current["lvlid"]);
                            mapData.starNum = current["score"];
                            bool flag4 = current.ContainsKey("last_enter_time");
                            if (flag4)
                            {
                                mapData.enterTime = current["last_enter_time"];
                            }
                            bool flag5 = current.ContainsKey("enter_times");
                            if (flag5)
                            {
                                mapData.cycleCount = current["enter_times"];
                            }
                            bool flag6 = current.ContainsKey("limit_tm");
                            if (flag6)
                            {
                                mapData.limit_tm = current["limit_tm"];
                            }
                            bool flag7 = mapData.type == 1;
                            if (flag7)
                            {
                                bool flag8 = mapData.starNum > 0 && mapData.id > num2;
                                if (flag8)
                                {
                                    num2 = mapData.id;
                                }
                            }
                            else
                            {
                                bool flag9 = mapData.type == 2;
                                if (flag9)
                                {
                                    bool flag10 = mapData.starNum > 0 && mapData.id > num3;
                                    if (flag10)
                                    {
                                        num3 = mapData.id;
                                    }
                                }
                            }
                        }
                        instance.setLastMapId(0, num2);
                        instance.setLastMapId(1, num3);
                        instance.inited = true;
                    }
                    bool flag11 = msgData.ContainsKey("mlzd_diff");
                    if (flag11)
                    {
                        ModelBase <A3_ActiveModel> .getInstance().nowlvl = msgData["mlzd_diff"];
                    }
                    MapModel instance2 = MapModel.getInstance();
                    break;
                }

                case 2:
                {
                    int     id     = msgData["lvlid"];
                    MapData mapDta = MapModel.getInstance().getMapDta(id);
                    mapDta.count = msgData["left_times"];
                    List <Variant>             arr2 = msgData["rewards"]._arr;
                    int                        num4 = arr2.Count / 3;
                    int                        num5 = 0;
                    List <List <MapItemData> > list = new List <List <MapItemData> >();
                    for (int i = 0; i < num4; i++)
                    {
                        List <MapItemData> list2 = new List <MapItemData>();
                        for (int j = 0; j < 3; j++)
                        {
                            list2.Add(new MapItemData
                                {
                                    id    = arr2[num5]["tpid"],
                                    count = arr2[num5]["cnt"]
                                });
                            num5++;
                        }
                        list.Add(list2);
                    }
                    break;
                }

                case 3:
                {
                    int     id     = msgData["lvlid"];
                    MapData mapDta = MapModel.getInstance().getMapDta(id);
                    mapDta.count      = msgData["left_times"];
                    mapDta.resetCount = msgData["left_reset_times"];
                    break;
                }

                case 4:
                {
                    int  num6   = msgData["lvlid"];
                    bool flag12 = instance.containerID(num6);
                    if (!flag12)
                    {
                        MapData mapData = instance.getMapDta(num6);
                        bool    flag13  = mapData == null;
                        if (!flag13)
                        {
                            mapData.starNum    = msgData["score"];
                            mapData.count      = msgData["left_times"];
                            mapData.resetCount = msgData["left_reset_times"];
                            bool flag14 = num6 == 104;
                            if (flag14)
                            {
                                bool flag15 = msgData.ContainsKey("diff_lvl");
                                if (flag15)
                                {
                                    ModelBase <A3_ActiveModel> .getInstance().nowlvl = msgData["diff_lvl"];
                                }
                            }
                        }
                    }
                    break;
                }
                }
            }
        }