Exemple #1
0
        public override void onClosed()
        {
            //  InterfaceMgr.getInstance().floatUI.localScale = Vector3.one;
            destorycontain();
            openWindow();
            disposeAvatar();

            room     = null;
            _NewOne  = false;
            instance = null;
            clearAwd();
            if (closefb_way == true)
            {
                LevelProxy.getInstance().sendLeave_lvl();
            }
            if (GameObject.Find("GAME_CAMERA/myCamera"))
            {
                GameObject cameraOBJ = GameObject.Find("GAME_CAMERA/myCamera");
                if (cameraOBJ.GetComponent <DeathShader>())
                {
                    cameraOBJ.GetComponent <DeathShader>().enabled = false;
                }
            }
        }
Exemple #2
0
        public override void onShowed()
        {
            if (room is MLZDRoom)
            {
                //打开活动界面
                ismlzd = true;
            }

            InterfaceMgr.getInstance().closeAllWin();
            a3_insideui_fb.instance?.enter_pic2.SetActive(false);
            jjc.SetActive(false);
            jdzc.SetActive(false);
            cityWAr.SetActive(false);
            ar_result.SetActive(false);
            getGameObjectByPath("win/success").SetActive(false);
            getGameObjectByPath("state_successed").SetActive(false);
            transform.FindChild("state_successed/bg/goldNum").gameObject.SetActive(false);
            transform.FindChild("state_successed/bg/getNum").gameObject.SetActive(false);
            tip_text.SetActive(true);
            bgdefet.SetActive(false);
            bgwin.SetActive(false);
            yiwufb_defet.SetActive(false);
            //  closefb_way = false;
            transform.FindChild("btn_close/closeTime").gameObject.SetActive(false);
            //createAvatar();
            closetime  = 0;
            close_time = 0;
            Variant data = (Variant)uiData[0];

            if (data.ContainsKey("ltpid"))
            {
                ltpid = data["ltpid"];
            }
            if (data.ContainsKey("score"))
            {
                score = data["score"];
            }
            else
            {
                score = 0;
            }

            if (data.ContainsKey("close_tm"))
            {
                double ct = data["close_tm"];
                closetime = ct;
            }
            if (data.ContainsKey("win"))
            {
                int ct = data["win"];

                Transform wint = getTransformByPath("win");
                wint.gameObject.SetActive(true);
                if (ct > 0 && wint != null)
                {
                    wint.FindChild("success").gameObject.SetActive(true);
                    wint.FindChild("fail").gameObject.SetActive(false);
                }
                else if (wint != null)
                {
                    closeWindow();
                    // InterfaceMgr.getInstance().floatUI.localScale = Vector3.zero;
                    if (GameObject.Find("GAME_CAMERA/myCamera"))
                    {
                        GameObject cameraOBJ = GameObject.Find("GAME_CAMERA/myCamera");
                        if (!cameraOBJ.GetComponent <DeathShader>())
                        {
                            cameraOBJ.AddComponent <DeathShader>();
                        }
                        else
                        {
                            cameraOBJ.GetComponent <DeathShader>().enabled = true;
                        }
                    }
                    wint.FindChild("success").gameObject.SetActive(false);
                    wint.FindChild("fail").gameObject.SetActive(true);


                    getGameObjectByPath("state_successed").SetActive(false);
                }
                if (data.ContainsKey("item_drop"))
                {
                    ct = data["item_drop"]._arr.Count;
                }
                else
                {
                    ct = 0;
                }
                if (ct >= 0)
                {
                    getGameObjectByPath("state_successed").SetActive(true);
                    //getGameObjectByPath("state_failed").SetActive(false);

                    finishTiem = getComponentByPath <Text>("state_successed/bg/fnTime/time");
                    kmNum      = getComponentByPath <Text>("state_successed/bg/kmNum/num");
                    getNum     = getComponentByPath <Text>("state_successed/bg/getNum/num");
                    goldNum    = getComponentByPath <Text>("state_successed/bg/goldNum/num");
                }
                else
                {
                    getGameObjectByPath("state_successed").SetActive(false);
                    //getGameObjectByPath("state_failed").SetActive(true);
                    //finishTiem = getComponentByPath<Text>("state_failed/bg/fnTime/time");
                    //kmNum = getComponentByPath<Text>("state_failed/bg/kmNum/num");
                    //getNum = getComponentByPath<Text>("state_failed/bg/getNum/num");
                    //goldNum = getComponentByPath<Text>("state_failed/bg/goldNum/num");
                }
            }

            finishtime = 0;
            if (uiData.Count > 1)
            {
                finishtime = (double)uiData[1];
            }
            //TimeSpan ts = new TimeSpan(0, 0, (int)finishtime);

            float tss = 0;
            uint  tkn = 0, ten = 0, tgn = 0;
            int   ach = 0, mon = 0;

            DOTween.To(() => tss, (float s) =>
            {
                TimeSpan ts     = new TimeSpan(0, 0, (int)s);
                finishTiem.text = (int)ts.TotalHours + ":" + (int)ts.Minutes + ":" + (int)ts.Seconds;
            }, (float)finishtime, 1f);

            evaluation(score);

            kmnum = 0;
            if (uiData.Count > 2)
            {
                kmnum = (int)uiData[2];
            }
            DOTween.To(() => (int)tkn, (int s) =>
            {
                tkn        = (uint)s;
                kmNum.text = tkn.ToString();
            }, kmnum, 1f);


            if (room is MoneyRoom)
            {
                if (room != null)
                {
                    transform.FindChild("state_successed/bg/goldNum").gameObject.SetActive(true);
                }
            }


            if (room is ExpRoom)
            {
                if (room != null)
                {
                    transform.FindChild("state_successed/bg/getNum").gameObject.SetActive(true);
                }
            }
            //if (room != null)
            //{
            //    goldnum = room.goldnum;
            //}
            //DOTween.To(() => tgn, (uint s) =>
            //{
            //    tgn = s;
            //    goldNum.text = tgn.ToString();
            //}, goldnum, 1f);

            //}


            if (room is PVPRoom)
            {
                if (room != null)
                {
                    getach = room.getach;
                }
                DOTween.To(() => ach, (int s) =>
                {
                    ach         = s;
                    getNum.text = ach.ToString();
                }, getach, 1f);

                if (room != null)
                {
                    getmoney = room.getExp;
                }
                DOTween.To(() => mon, (int s) =>
                {
                    mon          = s;
                    goldNum.text = mon.ToString();
                }, getmoney, 1f);

                MapProxy.getInstance().Win_uiData = "sports_jjc";
                MapProxy.getInstance().openWin    = InterfaceMgr.A3_SPORTS;
            }
            else
            {
                if (room != null)
                {
                    getnum = room.expnum;
                }
                DOTween.To(() => ten, (uint s) =>
                {
                    ten         = s;
                    getNum.text = ten.ToString();
                }, getnum, 1f);
                if (room != null)
                {
                    //goldnum = room.goldnum;
                    goldnum = a3_insideui_fb.AllMoneynum;
                }
                DOTween.To(() => tgn, (uint s) =>
                {
                    tgn          = s;
                    goldNum.text = tgn.ToString();
                }, goldnum, 1f);
            }
            //if (data.ContainsKey("ltpid")) {
            //    int tid = data["ltpid"];
            //    if (tid == 101) {
            //        getNum.text = "获得经验量:" + getnum;
            //    }
            //    else if (tid == 102) {
            //        getNum.text = "获得金币量:" + getnum;
            //    }
            //}
            _NewOne     = true;
            instance    = this;
            room.getExp = 0;
            room.getach = 0;

            Variant d = SvrLevelConfig.instacne.get_level_data(ltpid);

            if (data["win"] == 0 || room is PVPRoom || d.ContainsKey("shengwu") || room is PlotRoom || room is ExpRoom || room is MoneyRoom || room is FSWZRoom || room is MLZDRoom || room is JDZCRoom || room is CityWarRoom)
            {
                a3_liteMinimap.instance?.taskinfo?.SetActive(true);
                a3_insideui_fb.instance?.enter_pic2?.SetActive(false);

                LevelProxy.getInstance().open_pic = false;
                closefb_way = true;
                //InterfaceMgr.getInstance().close(InterfaceMgr.TARGET_HEAD);
            }
            else
            {
                closefb_way = false;
            }


            if (closefb_way == true)
            {
                close_time = 0;
                transform.FindChild("btn_close/closeTime").gameObject.SetActive(true);
            }
            if (closefb_way == false)
            {
                close_time = (double)closetime - (double)muNetCleint.instance.CurServerTimeStamp - 3;
                transform.FindChild("btn_close/closeTime").gameObject.SetActive(false);
            }

            if (d.ContainsKey("shengwu") && d.ContainsKey("icon"))
            {
                shengwu = d["shengwu"];
                icon    = d["icon"];
                if (data["win"] == 0)
                {
                    jjc.SetActive(false);
                    jdzc.SetActive(false);
                    cityWAr.SetActive(false);
                    ar_result.SetActive(false);
                    getGameObjectByPath("win").SetActive(false);
                    getGameObjectByPath("win/success").SetActive(false);
                    getGameObjectByPath("state_successed").SetActive(false);
                    transform.FindChild("state_successed/bg/goldNum").gameObject.SetActive(false);
                    bgdefet.SetActive(false);
                    bgwin.SetActive(false);
                    yiwufb_defet.SetActive(true);
                    return;
                }
            }
            else
            {
                shengwu = 0;
            }
            if (data["win"] == 1 && d.ContainsKey("shengwu") && d.ContainsKey("des"))
            {
                icon1 = d["des"];
                string[] codess = icon1.Split(',');
                // SXML xml = XMLMgr.instance.GetSXML("accent_relic.relic", "type=="+codess[0].ToString());
                //mid = xml.getUint("obj");
                List <SXML> listSxml = null;
                if (listSxml == null)
                {
                    listSxml = XMLMgr.instance.GetSXMLList("accent_relic.relic");
                    //List<SXML> xml2 = XMLMgr.instance.GetSXMLList("accent_relic.relic", "carr=="+ PlayerModel.getInstance().profession);     , "carr==" + PlayerModel.getInstance().profession
                    for (int i = 0; i < listSxml.Count; i++)
                    {
                        if (listSxml[i].getInt("carr") == PlayerModel.getInstance().profession&& listSxml[i].getString("type") == codess[0].ToString())
                        {
                            List <SXML> god_id = listSxml[i].GetNodeList("relic_god", "id==" + codess[1].ToString());
                            {
                                foreach (SXML x in god_id)
                                {
                                    text1.text = x.getString("des1");
                                    text2.text = x.getString("des2");
                                }
                            }
                        }
                    }
                }



                //foreach (SXML x in xml)
                //{
                //    if (x.getString("id") == codess[1])
                //    {
                //        text1.text = x.getString("des1");
                //        text2.text = x.getString("des2");
                //    }
                // }


                //    if (xml.getInt("carr") == PlayerModel.getInstance().profession)
                //{

                //    text1.text = xml.getString("des1");
                //    text2.text = xml.getString("des2");

                //}
            }



            if (shengwu == 1)
            {
                ar_result.SetActive(true);
                string[] codes = icon.Split(',');
                if (PlayerModel.getInstance().profession == 2)
                {
                    pic_icon.transform.GetComponent <Image>().sprite = GAMEAPI.ABUI_LoadSprite("icon_ar_" + codes[0]);
                }
                if (PlayerModel.getInstance().profession == 3)
                {
                    pic_icon.transform.GetComponent <Image>().sprite = GAMEAPI.ABUI_LoadSprite("icon_ar_" + codes[1]);
                }
                if (PlayerModel.getInstance().profession == 5)
                {
                    pic_icon.transform.GetComponent <Image>().sprite = GAMEAPI.ABUI_LoadSprite("icon_ar_" + codes[2]);
                }

                bgwin.SetActive(false);
                getGameObjectByPath("win").SetActive(false);
                getGameObjectByPath("win/success").SetActive(false);
                transform.FindChild("state_successed").gameObject.SetActive(false);
                jjc.SetActive(false);
                jdzc.SetActive(false);
                cityWAr.SetActive(false);
            }
            jjc.SetActive(false);
            jdzc.SetActive(false);
            cityWAr.SetActive(false);
            if (room is PVPRoom)
            {
                jjc.SetActive(false);
                ar_result.SetActive(false);
                getGameObjectByPath("win").SetActive(false);
                getGameObjectByPath("state_successed").SetActive(false);
                bgdefet.SetActive(false);
                bgwin.SetActive(false);
                if (data.ContainsKey("win"))
                {
                    int cct = data["win"];
                    if (cct == 0)
                    {
                        jjc.SetActive(true);
                        jjc.transform.FindChild("vector").gameObject.SetActive(false);
                        jjc.transform.FindChild("defet").gameObject.SetActive(true);
                    }
                    else
                    {
                        jjc.SetActive(true);
                        jjc.transform.FindChild("vector").gameObject.SetActive(true);
                        jjc.transform.FindChild("defet").gameObject.SetActive(false);
                    }
                    int aa = a3_sportsModel.getInstance().grade;
                    if (aa < 10)
                    {
                        icon_star.GetComponent <Image>().sprite = GAMEAPI.ABUI_LoadSprite("icon_rank_00" + aa);
                    }
                    else
                    {
                        icon_star.GetComponent <Image>().sprite = GAMEAPI.ABUI_LoadSprite("icon_rank_0" + aa);
                    }
                    if (a3_sportsModel.getInstance().grade <= 0)
                    {
                        return;
                    }
                    SXML Xml        = XMLMgr.instance.GetSXML("jjc.reward", "grade==" + a3_sportsModel.getInstance().grade);
                    int  pointCount = Xml.getInt("star");
                    if (pointCount <= 0)
                    {
                        return;
                    }
                    Transform star = this.transform.FindChild("jjc/star");
                    for (int i = 0; i < star.childCount; i++)
                    {
                        star.GetChild(i).FindChild("this").gameObject.SetActive(false);
                        star.GetChild(i).gameObject.SetActive(false);
                    }
                    for (int m = pointCount; m > 0; m--)
                    {
                        star.GetChild(m - 1).gameObject.SetActive(true);
                    }
                    for (int j = 0; j < a3_sportsModel.getInstance().score; j++)
                    {
                        star.GetChild(j).FindChild("this").gameObject.SetActive(true);
                    }
                }
            }

            if (room is JDZCRoom)
            {
                jjc.SetActive(false);
                ar_result.SetActive(false);
                jdzc.SetActive(false);
                cityWAr.SetActive(false);
                tip_text.SetActive(false);
                getGameObjectByPath("win").SetActive(false);
                getGameObjectByPath("state_successed").SetActive(false);
                bgdefet.SetActive(false);
                bgwin.SetActive(false);
                if (data.ContainsKey("win"))
                {
                    int cct = data["win"];
                    jdzc.SetActive(true);

                    if (cct == 0)
                    {
                        GameObject item = jdzc.transform.FindChild("fail/gift/reward").gameObject;
                        Transform  con  = jdzc.transform.FindChild("fail/gift/contain");
                        jdzc.transform.FindChild("win").gameObject.SetActive(false);
                        jdzc.transform.FindChild("fail").gameObject.SetActive(true);
                        SXML        Xml_lose = XMLMgr.instance.GetSXML("pointarena.lose_reward");
                        List <SXML> rew      = Xml_lose.GetNodeList("RewardItem");
                        foreach (SXML one in rew)
                        {
                            GameObject clon = Instantiate(item) as GameObject;
                            clon.SetActive(true);
                            clon.transform.SetParent(con, false);
                            uint       id   = (uint)one.getInt("item_id");
                            int        num  = one.getInt("value");
                            GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(id);
                            icon.transform.SetParent(clon.transform.FindChild("pic/icon"), false);
                            clon.transform.FindChild("pic/num").GetComponent <Text>().text = num.ToString();
                        }
                    }
                    else
                    {
                        GameObject item = jdzc.transform.FindChild("win/gift/reward").gameObject;
                        Transform  con  = jdzc.transform.FindChild("win/gift/contain");
                        jdzc.transform.FindChild("win").gameObject.SetActive(true);
                        jdzc.transform.FindChild("fail").gameObject.SetActive(false);
                        SXML        Xml_win = XMLMgr.instance.GetSXML("pointarena.win_reward");
                        List <SXML> rew     = Xml_win.GetNodeList("RewardItem");
                        foreach (SXML one in rew)
                        {
                            GameObject clon = Instantiate(item) as GameObject;
                            clon.SetActive(true);
                            clon.transform.SetParent(con, false);
                            uint       id   = (uint)one.getInt("item_id");
                            int        num  = one.getInt("value");
                            GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(id);
                            icon.transform.SetParent(clon.transform.FindChild("pic/icon"), false);
                            clon.transform.FindChild("pic/num").GetComponent <Text>().text = num.ToString();
                        }
                    }
                }
            }

            if (room is CityWarRoom)
            {
                jjc.SetActive(false);
                ar_result.SetActive(false);
                jdzc.SetActive(false);
                tip_text.SetActive(false);
                cityWAr.SetActive(false);
                getGameObjectByPath("win").SetActive(false);
                getGameObjectByPath("state_successed").SetActive(false);
                bgdefet.SetActive(false);
                bgwin.SetActive(false);
                cityWAr.transform.FindChild("win/warinfo").gameObject.SetActive(false);
                if (data.ContainsKey("win"))
                {
                    int cct = data["win"];

                    cityWAr.SetActive(true);
                    if (cct == 0)
                    {
                        GameObject item = cityWAr.transform.FindChild("fail/gift/reward").gameObject;
                        Transform  con  = cityWAr.transform.FindChild("fail/gift/contain");
                        cityWAr.transform.FindChild("win").gameObject.SetActive(false);
                        cityWAr.transform.FindChild("fail").gameObject.SetActive(true);
                        if (PlayerModel.getInstance().lvlsideid == 1)
                        {//攻城
                            SXML        Xml_win   = XMLMgr.instance.GetSXML("clanwar.atk_awd", "min==" + 0);
                            List <SXML> rew       = Xml_win.GetNodeList("RewardItem");
                            List <SXML> awds_coin = Xml_win.GetNodeList("RewardValue");
                            setAwd(con, item, rew, awds_coin);
                        }
                        else
                        {
                            //守城
                            SXML        Xml_win   = XMLMgr.instance.GetSXML("clanwar.def_awd", "min==" + 0);
                            List <SXML> rew       = Xml_win.GetNodeList("RewardItem");
                            List <SXML> awds_coin = Xml_win.GetNodeList("RewardValue");
                            setAwd(con, item, rew, awds_coin);
                        }
                    }

                    else
                    {
                        GameObject item = cityWAr.transform.FindChild("win/gift/reward").gameObject;
                        Transform  con  = cityWAr.transform.FindChild("win/gift/contain");
                        cityWAr.transform.FindChild("win").gameObject.SetActive(true);
                        cityWAr.transform.FindChild("fail").gameObject.SetActive(false);
                        if (PlayerModel.getInstance().lvlsideid == 1)
                        {//攻城
                            int i = data["rank"];
                            if (data["win_clanid"])
                            {
                                cityWAr.transform.FindChild("win/warinfo").gameObject.SetActive(true);
                                if (A3_LegionModel.getInstance().myLegion != null && A3_LegionModel.getInstance().myLegion.id == data["win_clanid"])
                                {
                                    cityWAr.transform.FindChild("win/warinfo").GetComponent <Text>().text = ContMgr.getCont("uilayer_a3_fb_finish_11");
                                }
                                else
                                {
                                    cityWAr.transform.FindChild("win/warinfo").GetComponent <Text>().text = ContMgr.getCont("uilayer_a3_fb_finish_12");
                                }
                            }
                            cityWAr.transform.FindChild("win/info").GetComponent <Text>().text = ContMgr.getCont("uilayer_a3_fb_finish_9", new List <string> {
                                i.ToString()
                            });
                            SXML        Xml_win = XMLMgr.instance.GetSXML("clanwar");
                            List <SXML> awd     = Xml_win.GetNodeList("atk_awd");
                            foreach (SXML s in awd)
                            {
                                if (s.getInt("min") <= i && s.getInt("max") >= i)
                                {
                                    List <SXML> rew       = Xml_win.GetNodeList("RewardItem");
                                    List <SXML> awds_coin = Xml_win.GetNodeList("RewardValue");
                                    setAwd(con, item, rew, awds_coin);
                                    break;
                                }
                            }
                        }
                        else
                        {
                            //守城
                            int i = data["hpper"];
                            cityWAr.transform.FindChild("win/info").GetComponent <Text>().text = ContMgr.getCont("uilayer_a3_fb_finish_10", new List <string> {
                                i.ToString()
                            });
                            SXML        Xml_win = XMLMgr.instance.GetSXML("clanwar");
                            List <SXML> awd     = Xml_win.GetNodeList("def_awd");
                            foreach (SXML s in awd)
                            {
                                if (s.getInt("min") <= i && s.getInt("max") >= i)
                                {
                                    List <SXML> rew       = s.GetNodeList("RewardItem");
                                    List <SXML> awds_coin = s.GetNodeList("RewardValue");
                                    setAwd(con, item, rew, awds_coin);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }