void initdata()
        {
            ishavemy = false;
            Dictionary <int, bossrankingdata> dic_bsks = A3_EliteMonsterModel.getInstance().dic_bsk;


            int lenth = dic_bsks.Count;

            foreach (int nu in dic.Keys)
            {
                if (nu >= lenth)
                {
                    dic[nu].SetActive(false);
                }
                else
                {
                    dic[nu].SetActive(true);
                }
            }

            int j = 0;

            foreach (int i in dic_bsks.Keys)
            {
                int    cid  = dic_bsks[i].cid;
                string name = dic_bsks[i].name;
                uint   dmg  = dic_bsks[i].dmg;
                int    num  = j;
                dic[j].transform.FindChild("ranking").GetComponent <Text>().text = (num + 1).ToString();
                dic[j].transform.FindChild("name").GetComponent <Text>().text    = name;
                dic[j].transform.FindChild("hurt").GetComponent <Text>().text    = dmg.ToString();
                if (PlayerModel.getInstance().cid == cid)
                {
                    ishavemy = true;
                    getComponentByPath <Text>("bossranking/down/name").text     = (num + 1).ToString();
                    getComponentByPath <Text>("bossranking/down/shanghai").text = dmg.ToString();
                }
                j++;
            }
            a3_runestone.commonScroview(contain, lenth);
            if (!ishavemy)
            {
                getComponentByPath <Text>("bossranking/down/name").text     = "未上榜";
                getComponentByPath <Text>("bossranking/down/shanghai").text = "";
            }

            CancelInvoke("hidebtn");
            Invoke("hidebtn", 10);
        }
Пример #2
0
        private void RefreshEliteMonInfo(Variant data)
        {
            var            emonList = A3_EliteMonsterModel.getInstance().dicEMonInfo;
            List <Variant> listData;

            if (data.ContainsKey("elite_mon"))
            {
                listData = data["elite_mon"]._arr;
                for (int i = 0; i < listData.Count; i++)
                {
                    uint monId = listData[i]["mid"]._uint;

                    if (!emonList.ContainsKey(monId))
                    {
                        //emonList.Add(monId, new EliteMonsterInfo(
                        //    lastKilledDate: listData[i].ContainsKey("kill_tm") ? listData[i]["kill_tm"]._uint : 0,
                        //    respawnTime: listData[i].ContainsKey("respawntm") ? listData[i]["respawntm"]._uint : 0,
                        //    killerName: listData[i].ContainsKey("killer_name") ? listData[i]["killer_name"]._str : "",
                        //    mapId: listData[i].ContainsKey("mapid") ? listData[i]["mapid"]._int : 0,
                        //    pos: listData[i].ContainsKey("mon_x") && listData[i].ContainsKey("mon_y") ? new Vector2(listData[i]["mon_x"]._int, listData[i]["mon_y"]._int) : default(Vector2),
                        //    monId: listData[i]["mid"]._uint
                        //));
                        A3_EliteMonsterModel.getInstance().AddData(listData[i]);
                    }
                    else
                    {
                        emonList[monId] = new EliteMonsterInfo(
                            lastKilledDate: listData[i].ContainsKey("kill_tm") ? listData[i]["kill_tm"]._uint : 0,
                            respawnTime: listData[i].ContainsKey("respawntm") ? listData[i]["respawntm"]._uint : 0,
                            killerName: listData[i].ContainsKey("killer_name") ? listData[i]["killer_name"]._str : null,
                            mapId: listData[i].ContainsKey("mapid") ? listData[i]["mapid"]._int : 0,
                            pos: listData[i].ContainsKey("mon_x") && listData[i].ContainsKey("mon_y") ? new Vector2(listData[i]["mon_x"]._int, listData[i]["mon_y"]._int) : Vector2.zero,
                            monId: listData[i]["mid"]._uint
                            );
                    }
                    string name = "";
                    if (listData[i].ContainsKey("killer_name"))
                    {
                        name = listData[i]["killer_name"];
                    }
                    if (listData[i].ContainsKey("dmg_list") && listData[i]["dmg_list"].Count > 0)
                    {
                        debug.Log("伤害排行");
                        List <dmg_list> lst = new List <dmg_list>();
                        for (int j = 0; j < listData[i]["dmg_list"].Count; j++)
                        {
                            int      ranks = j;
                            dmg_list sl    = new dmg_list();
                            sl.mid      = listData[i]["mid"]._int;
                            sl.cid      = listData[i]["dmg_list"][j]["cid"]._int;
                            sl.name     = listData[i]["dmg_list"][j]["name"]._str;
                            sl.dmg      = listData[i]["dmg_list"][j]["dmg"]._int;
                            sl.rank     = ranks + 1;
                            sl.lat_name = name;
                            lst.Add(sl);
                            A3_EliteMonsterModel.getInstance().dic_dmg_lst[sl.mid] = lst;
                        }
                    }
                }
                //iconlight
                uint       zhuan = PlayerModel.getInstance().up_lvl;
                uint       lv    = PlayerModel.getInstance().lvl;
                int        mosid = 30001;//最后一个开启的怪物id
                List <int> mids  = new List <int>();
                if (data.ContainsKey("elite_mon"))
                {
                    listData = data["elite_mon"]._arr;
                    for (int i = 0; i < listData.Count; i++)
                    {
                        mids.Add(listData[i]["mid"]._int);
                    }
                }
                mids.Sort();
                for (int i = 0; i < mids.Count; i++)
                {
                    if (zhuan > XMLMgr.instance.GetSXML("monsters.monsters", "id==" + mids[i]).getUint("zhuan"))
                    {
                        mosid = mids[i];
                    }
                    else if (zhuan == XMLMgr.instance.GetSXML("monsters.monsters", "id==" + mids[i]).getUint("zhuan"))
                    {
                        if (lv >= XMLMgr.instance.GetSXML("monsters.monsters", "id==" + mids[i]).getUint("zhuan"))
                        {
                            mosid = mids[i];
                        }
                        else
                        {
                            mosid = mids[i]; break;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                List <uint> lsts = new List <uint>();
                for (int i = 0; i < mids.Count; i++)
                {
                    if (mids[i] <= mosid)
                    {
                        foreach (Variant v in listData)
                        {
                            if (v["mid"] == mids[i])
                            {
                                if (v["kill_tm"] == 0)
                                {
                                    //亮
                                    IconAddLightMgr.getInstance().showOrHideFires("Open_Light_enterElite", null);
                                    break;
                                }
                                else
                                {
                                    IconAddLightMgr.getInstance().showOrHideFires("jingyingguai_Light_enterElite", null);
                                }
                                //不亮
                            }
                        }
                    }
                }
            }
        }
Пример #3
0
        public void EltMon_OnEMOp(Variant data)
        {
            debug.Log("收到156协议!!!!!!!!!!!!!!!!!!!!!!!" + data.dump());
            int res = data["res"];

            if (res < 0)
            {
                Globle.err_output(res);
            }
            switch (res)
            {
            case 1:
                A3_EliteMonsterModel.getInstance().kill_cnt    = data["kill_cnt"]._int;
                A3_EliteMonsterModel.getInstance().vip_buy_cnt = data["vip_cnt"]._int;
                //a.死亡时发
                if (!data["elite_mon"]._arr[0].ContainsKey("mon_x"))
                {
                    SendProxy();
                }
                //b.复活时发
                else if (!data["elite_mon"]._arr[0].ContainsKey("killer_name"))
                {
                    SendProxy();
                }
                //IconAddLightMgr.getInstance().showOrHideFires("o_Light_enterElite", null);
                //c.请求回复,都发
                else
                {
                    RefreshEliteMonInfo(data);
                }
                dispatchEvent(GameEvent.alloc(EVENT_ELITEMONSTER, this, data));
                break;

            case 2:
                A3_EliteMonsterModel.getInstance().kill_cnt    = data["kill_cnt"]._int;
                A3_EliteMonsterModel.getInstance().vip_buy_cnt = data["vip_cnt"]._int;
                A3_EliteMonster.Instance?.RefreshVipCount();
                break;

            case 4:
                break;

            case 5:
                for (int i = 0; i < data["dmg_list"].Count; i++)
                {
                    bossrankingdata d = new bossrankingdata();
                    d.cid  = data["dmg_list"][i]["cid"]._int;
                    d.name = data["dmg_list"][i]["name"]._str;
                    d.dmg  = data["dmg_list"][i]["dmg"]._uint;
                    A3_EliteMonsterModel.getInstance().dic_bsk[d.cid] = d;
                }


                if (!isfristover)
                {
                    isfristover = true;
                    string path = "ui/interfaces/low/a1_low_fightgame";

                    InterfaceMgr.doCommandByLua("a1_low_fightgame.bossrkOp", path, null);
                    InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_BOSSRANKING);
                    //a3_expbar.instance?.BossRankingBtn.SetActive(true);
                }

                dispatchEvent(GameEvent.alloc(EVENT_SHOW, this, data));
                break;

            default:
                break;
            }
        }
        //2、世界boss操作
        public void Active_BOSSOP(Variant data)
        {
            debug.Log("166世界boss信息:" + data.dump());
            if (data.ContainsKey("boss_status"))
            {
                for (int i = 0; i < A3_EliteMonsterModel.getInstance().bossid.Length; i++)
                {
                    if (data["boss_status"][i] != null)
                    {
                        A3_EliteMonsterModel.getInstance().bossid[i]      = int.Parse(data["boss_status"][i]["index"].dump());
                        A3_EliteMonsterModel.getInstance().boss_status[i] = int.Parse(data["boss_status"][i]["status"].dump());
                        Debug.LogWarning("bossid" + A3_EliteMonsterModel.getInstance().bossid[i] + "+" + "boss_status" + A3_EliteMonsterModel.getInstance().boss_status[i]);


                        string name = "";
                        if (data["boss_status"][i].ContainsKey("killer_name"))
                        {
                            name = data["boss_status"][i]["killer_name"];
                        }
                        if (data["boss_status"][i].ContainsKey("dmg_list") && data["boss_status"][i]["dmg_list"].Count > 0)
                        {
                            debug.Log("伤害排行");
                            List <dmg_list> lst = new List <dmg_list>();
                            for (int j = 0; j < data["boss_status"][i]["dmg_list"].Count; j++)
                            {
                                int      ranks = j;
                                dmg_list sl    = new dmg_list();
                                int      mid   = 0;
                                switch (data["boss_status"][i]["index"]._int)
                                {
                                case 1:
                                    mid = 2012;
                                    break;

                                case 2:
                                    mid = 3126;
                                    break;

                                case 3:
                                    mid = 2000;
                                    break;

                                default:
                                    break;
                                }
                                sl.mid      = mid;
                                sl.cid      = data["boss_status"][i]["dmg_list"][j]["cid"]._int;
                                sl.name     = data["boss_status"][i]["dmg_list"][j]["name"]._str;
                                sl.dmg      = data["boss_status"][i]["dmg_list"][j]["dmg"]._int;
                                sl.rank     = ranks + 1;
                                sl.lat_name = name;
                                lst.Add(sl);
                                A3_EliteMonsterModel.getInstance().dic_dmg_lst[sl.mid] = lst;
                            }
                        }
                    }
                }
                dispatchEvent(GameEvent.Create(EliteMonsterProxy.EVENT_BOSSOPSUCCESS, this, data));
            }
            //收到boss死亡或者复活
            debug.Log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + data.dump());

            uint zhuan = PlayerModel.getInstance().up_lvl;
            Dictionary <int, int> dic = new Dictionary <int, int>();
            bool can = true;

            if (data.ContainsKey("index"))
            {
                string   xml       = XMLMgr.instance.GetSXML("worldboss.boss", "id==" + data["index"]).getString("level_limit");
                string[] str       = xml.Split(',');
                uint     needzhuan = uint.Parse(str[0]);
                //1:复活
                if (data["status"] == 1)
                {
                    if (zhuan >= needzhuan)
                    {
                        dic[data["index"]] = data["status"];
                        can = true;
                    }
                    else
                    {
                        if (dic.Count > 0)
                        {
                            can = true;
                        }
                        else
                        {
                            can = false;
                            EliteMonsterProxy.getInstance().SendProxy();
                        }
                    }
                    IconAddLightMgr.getInstance().showOrHideFires("shijieboss_Light_enterElite", can);
                }
                //2:死了
                else if (data["status"] == 2)
                {
                    if (dic.ContainsKey(data["index"]))
                    {
                        dic.Remove(data["index"]);
                    }
                    if (dic.Count > 0)
                    {
                        can = true;
                    }
                    else
                    {
                        can = false;
                        EliteMonsterProxy.getInstance().SendProxy();
                    }
                    IconAddLightMgr.getInstance().showOrHideFires("shijieboss_Light_enterElite", can);
                }
                //3:不存在
                else
                {
                }
            }
        }