Example #1
0
    private void InitRigester()
    {
        SoundManager.inst.Register(this.gameObject);
        MicroManager.inst.Register(this.gameObject);
        DispatchManager.inst.Register(MainEvent.RESTART_GAME, RESTART_GAME);
        DispatchManager.inst.Register(MainEvent.RELOGIN_GAME, RELOGIN_GAME);
        DispatchManager.inst.Register(MainEvent.SHOW_USER, SHOW_USER);
        DispatchManager.inst.Register(MainEvent.SOCKET_ERROR, SOCKET_ERROR);
        DispatchManager.inst.Register(MainEvent.FIGHT_RESULT, FIGHT_RESULT);
        DispatchManager.inst.Register(MainEvent.START_FIGHT, START_FIGHT);
        DispatchManager.inst.Register(MainEvent.CLOSE_FIGHT, CLOSE_FIGHT);
        DispatchManager.inst.Register(MainEvent.FIGHT_INIT_COMPLETE, FIGHT_INIT_COMPLETE);
        DispatchManager.inst.Register(MainEvent.FIGHT_QUIT, FIGHT_QUIT);
        DispatchManager.inst.Register(MainEvent.FIGHT_ING, FIGHT_ING);
        DispatchManager.inst.Register(MainEvent.SHOW_FIGHTDETAIL, SHOW_FIGHTDETAIL);
        DispatchManager.inst.Register(MainEvent.SOCKET_CLOSE, SOCKET_CLOSE);

        userModel  = ModelManager.inst.userModel;
        roleModel  = ModelManager.inst.roleModel;
        chatModel  = ModelManager.inst.chatModel;
        guildModel = ModelManager.inst.guildModel;
        fightModel = ModelManager.inst.fightModel;
        shareModel = ModelManager.inst.shareModel;

        gameModel.width  = GRoot.inst.width;
        gameModel.height = GRoot.inst.height;
        this.initQueue.Next();
    }
Example #2
0
 private void InitDate()
 {
     match_type         = 1;
     rank_type          = 2;
     list_rank          = this.GetChild("n1").asList;
     bgItem             = this.GetChild("n4").asImage;
     list_rank.emptyStr = Tools.GetMessageById("24239");
     emptyBg            = bgItem;
     list_rank.onChangeNum.Add(this.CheckListNum);
     list_rank.itemRenderer = Record_Render_fight;
     list_rank.SetVirtual();
     fight      = this.GetChild("n2").asButton;
     rank       = this.GetChild("n3").asButton;
     roleModel  = ModelManager.inst.roleModel;
     userModel  = ModelManager.inst.userModel;
     fightModel = ModelManager.inst.fightModel;
     ct1        = this.GetController("c1");
     ct1.onChanged.Add(OnChange);
     if (roleModel.tab_Role_Select3 != -1 && roleModel.tab_Role_Select3 != 0)
     {
         if (roleModel.uids.Count < 2)
         {
             ct1.selectedIndex          = roleModel.tab_Role_Select3;
             roleModel.tab_Role_Select3 = -1;
         }
         else
         {
             OnChange();
         }
     }
     else
     {
         OnChange();
     }
 }
    private void InitData()
    {
        roleModel     = ModelManager.inst.roleModel;
        userModel     = ModelManager.inst.userModel;
        fightModel    = ModelManager.inst.fightModel;
        fight_tag     = fightModel.GetFightTag();
        statementType = (string)fightModel.fightData["statementType"];
        mydata        = (object[])fightModel.fightData["my_data"];
        result        = (object[])fightModel.fightData["result"];
        fightIcon     = (Dictionary <string, object>)DataManager.inst.match["fight_level_win"];

        List <object> data = new List <object>(result);

        ModelFight.Sort(data, 1, 1);//根据战斗积分排序
        figthUser     = fightModel.GetFightUser(data, userModel.uid);
        userFightData = new List <object>();
        List <object> userData = fightModel.GetUserData(data, mydata, statementType);

        for (int i = 0; i < 6; i++)
        {
            Dictionary <string, object> dd = new Dictionary <string, object>();
            dd["data"]  = mydata[i];
            dd["rank"]  = (int)userData[i];
            dd["index"] = i;
            userFightData.Insert(i, dd);
        }
        //Tools.Sort(userFightData, new string[] {"rank:int:0" });
        list.itemRenderer = OnRendere;
        list.numItems     = userFightData.Count;
    }
    private void InitData()
    {
        rank_reward   = (Dictionary <string, object>)DataManager.inst.match["rank_reward_title"];
        match_reward  = (Dictionary <string, object>)DataManager.inst.match["match_reward_title"];
        statementType = fightModel.fightData["statementType"].ToString();

        if (statementType.Equals(ModelFight.FIGHT_MATCHGUIDE))
        {
            //新手引导
        }
        else
        {
            if (statementType.Equals(ModelFight.FIGHT_MATCHTEAM) || statementType.Equals(ModelFight.FIGHT_MATCH))
            {
                user = (Dictionary <string, object>)fightModel.fightData["user"];
            }
            object[]      result = (object[])fightModel.fightData["result"];
            List <object> data   = new List <object>(result);
            ModelFight.Sort(data, 1, 1);
            figthUserInfo = fightModel.GetFightUser(data, userModel.uid);
        }
        Match();
        MatchGuild();
        MatchTeam();
    }
Example #5
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_INVITE, false);         //Tools.GetMessageById ("25032")

        fightModel = ModelManager.inst.fightModel;
        userModel  = ModelManager.inst.userModel;

        this.GetChild("n7").text = Tools.GetMessageById("25036", new string[] { "0" });
        check = this.GetChild("n6").asButton;
        check.onClick.Add(Check_Click);
        //
        btn_Close = this.GetChild("close").asButton;
        btn_Close.onClick.Add(this.Close);
        BaseMediator.emptyBg = this.GetChild("n26");
//		this.GetChild ("n1").text = Tools.GetMessageById ("25041");
//		this.GetChild ("n3").text = Tools.GetMessageById ("25042");
//		this.GetChild ("n2").text = Tools.GetMessageById ("25043");
//		this.GetChild ("n4").text = Tools.GetMessageById ("25044");
        this.GetChild("n10").text = Tools.GetMessageById("25045");

        btn_Invite = this.GetChild("n8").asButton;
        btn_Invite.onClick.Add(Invite_Click);
        btn_Invite.text = Tools.GetMessageById("25063");
//		this.GetChild ("n20").asButton.onClick.Add (BtnCheck_Click);
        list = this.GetChild("n9").asList;
        list.onChangeNum.Add(this.CheckListNum);
        list.itemRenderer = ItemRender;
        list.SetVirtual();

        //InitTopBar (new string[]{Tools.GetMessageById ("25041"),Tools.GetMessageById ("25042"),Tools.GetMessageById ("25043"),Tools.GetMessageById ("25044")});

        if (!userModel.GetUnlcok(Config.UNLOCK_GUILD))
        {
            InitTopBar(new string[] { Tools.GetMessageById("25041"), Tools.GetMessageById("25042"), "", Tools.GetMessageById("25044") });
        }
        else
        {
            InitTopBar(new string[] { Tools.GetMessageById("25041"), Tools.GetMessageById("25042"), Tools.GetMessageById("25043"), Tools.GetMessageById("25044") });
        }
        tabC1 = this.GetController("c1");
//		tabC2 = c1;
        tabC1.onChanged.Add(C1_Change);
        if (fightModel.inviteIndex != -1)
        {
            tabC1.selectedIndex    = fightModel.inviteIndex;
            fightModel.inviteIndex = -1;
        }
        else
        {
            C1_Change();
        }

        this.AddGlobalListener(MainEvent.SOCKET_CLOSE, (MainEvent e) =>
        {
            this.Close();
        });
    }
Example #6
0
 private void InitDate()
 {
     selectColor = "9E5600";
     normalColor = "215CB4";
     userModel   = ModelManager.inst.userModel;
     roleModel   = ModelManager.inst.roleModel;
     fightModel  = ModelManager.inst.fightModel;
     otherRole   = roleModel.otherInfo;
 }
Example #7
0
 public void Register()
 {
     gameModel  = new ModelGame();
     alertModel = new ModelAlert();
     userModel  = new ModelUser();
     roleModel  = new ModelRole();
     guildModel = new ModelGuild();
     chatModel  = new ModelChat();
     cardModel  = new ModelCard();
     mailModel  = new ModelMail();
     fightModel = new ModelFight();
     rankModel  = new ModelRank();
     guideModel = new ModelGuide();
     shareModel = new ModelShare();
 }
 public override void Init()
 {
     base.Init();
     Create(Config.VIEW_FIGTHTDATASHARE, false, Tools.GetMessageById("24233"));
     fightModel       = ModelManager.inst.fightModel;
     userModel        = ModelManager.inst.userModel;
     roleModel        = ModelManager.inst.roleModel;
     fightDataDetails = (object[])fightModel.fightDataDetails[fightModel.recordIndex];
     text             = this.GetChild("n0").asTextInput;
     text.promptText  = Tools.GetMessageById("24236");
     text.maxLength   = (int)DataManager.inst.systemSimple["share_fight"];
     ok      = this.GetChild("n4").asButton;
     ok.text = Tools.GetMessageById("24234");
     ok.RemoveEventListeners();
     ok.onClick.Add(SendShare);
 }
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_FIGHTWORLD);

        fightModel = ModelManager.inst.fightModel;
        roleModel  = ModelManager.inst.roleModel;

        button = this.GetChild("n3").asButton;
        button.onClick.Add(Result_Click);

        button.visible = fightModel.isLeader;

        NetSocket.inst.AddListener(NetBase.SOCKET_GETRESUILTTEAMPUSH, (VoSocket vo) =>
        {
            NetSocket.inst.RemoveListener(NetBase.SOCKET_GETRESUILTTEAMPUSH);

            Dictionary <string, object> data = new Dictionary <string, object> ();
            data ["data"] = vo.data;
            data ["type"] = fightModel.fightType;
            DispatchManager.inst.Dispatch(new MainEvent(MainEvent.FIGHT_RESULT, data));
        });

//		NetSocket.inst.AddListener (NetBase.SOCKET_GETRESUILTPUSH, (VoSocket vo) =>
//		{
//			NetSocket.inst.RemoveListener (NetBase.SOCKET_GETRESUILTPUSH);
//
//			Dictionary<string,object> data = new Dictionary<string, object> ();
//			data ["data"] = vo.data;
//			data ["type"] = fightModel.fightType;
//			DispatchManager.inst.Dispatch (new MainEvent (MainEvent.FIGHT_RESULT, data));
//		});

        NetSocket.inst.AddListener(NetBase.SOCKET_GETRESULTFREEMATCHPUSH, (VoSocket vo) =>
        {
            NetSocket.inst.RemoveListener(NetBase.SOCKET_GETRESULTFREEMATCHPUSH);

            Dictionary <string, object> data = new Dictionary <string, object> ();
            data ["data"] = vo.data;
            data ["type"] = fightModel.fightType;
            DispatchManager.inst.Dispatch(new MainEvent(MainEvent.FIGHT_RESULT, data));
        });
        roleModel.ClearFightData();
    }
Example #10
0
    public override void Init()
    {
        base.Init();
        this.Create(Config.VIEW_MICRO);
        this.x = 0;
        this.y = 0;

        fightModel = ModelManager.inst.fightModel;

//		this.x = -GRoot.inst.width / 2 + this.width / 2;
//		this.y = -GRoot.inst.height / 2 + this.height / 2 + 150;

        list = this.GetChild("n0").asList;
        list.itemRenderer = Item_Render;
        this.height       = fightModel.micros.Count * 50 + (fightModel.micros.Count - 1) * 5;
        this.y            = 0;
//		list.visible = false;

        this.AddGlobalListener(MainEvent.MICRO_ADD, MICRO_ADD);
    }
Example #11
0
    public void Socket_loginBack(VoSocket vo)
    {
        if (vo.data is Boolean)
        {
            //					Debug.LogError("SOCKET_LOGIN false");
            NetSocket.inst.socketLogin = false;
        }
        else
        {
            //					Debug.LogError("SOCKET_LOGIN true");
            //				Log.debug ("Socket Login - " + vo.data.ToString ());
            NetSocket.inst.socketLogin = true;            //Convert.ToBoolean (vo.data);

            Dictionary <string, object> re = (Dictionary <string, object>)vo.data;
            bool isBattle = Convert.ToBoolean(re ["in_battle"]);
            if (isBattle)
            {
                int        typeId     = (int)re ["type"];
                ModelFight fightModel = ModelManager.inst.fightModel;
                fightModel.isLeader = true;
                if (typeId == 1)
                {
                    fightModel.fightType = ModelFight.FIGHT_MATCH;
                }
                else if (typeId == 2)
                {
                    fightModel.fightType = ModelFight.FIGHT_MATCHTEAM;
                }
                else if (typeId == 3)
                {
                    fightModel.fightType = ModelFight.FIGHT_FREEMATCH1;
                }
                DispatchManager.inst.Dispatch(new MainEvent(MainEvent.FIGHT_ING));
            }
            else
            {
            }
        }
        Main.inst.Socket_Listen();
    }
Example #12
0
    private void FIGHT_ING(MainEvent e)
    {
//		GRoot.inst.visible = true;
        ModelFight fightModel = ModelManager.inst.fightModel;

//		fightModel.isLeader = true;
        ViewManager.inst.ShowText("战斗进行中。。。!中途退出过战斗");
        if (e.data != null && e.data is string)
        {
//			ViewManager.inst.ShowAlert ("战斗进行中。。继续战斗 ", (int v) =>
//			{
//				ViewManager.inst.CloseView ();
//			}, false, false);
        }
        else
        {
//			ViewManager.inst.ShowAlert ("战斗进行中。。继续战斗 ", (int v) =>
//			{
//				ViewManager.inst.ShowScene <MediatorFightWorld> (true);
//			});
        }
    }
    /*-		fightModel.fightData	Count=7	System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
     * -		["gifts"]	{System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]}	System.Collections.DictionaryEntry
     +		    ["el_score"]	400	System.Collections.DictionaryEntry
     +		    ["card"]	{System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]}	System.Collections.DictionaryEntry
     +		    ["gold"]	12	System.Collections.DictionaryEntry
     + -		["result"]	System.Object[8]	System.Collections.DictionaryEntry
     + -		    [0]	System.Object[3]	System.Object
     + [0]	1267	System.Object
     + -		[1]	System.Object[6]	System.Object
     + [0]	1209	System.Object
     + [1]	7	System.Object
     + [2]	1	System.Object
     + [3]	998	System.Object
     + [4]	21	System.Object
     + [5]	8	System.Object
     + -		        [2]	Count=15	System.Object
     +		["head"]	{System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]}	System.Collections.DictionaryEntry
     +		["guild_id"]	null	System.Collections.DictionaryEntry
     +		["uid"]	1267	System.Collections.DictionaryEntry
     +		["is_friend"]	false	System.Collections.DictionaryEntry
     +		["name"]	null	System.Collections.DictionaryEntry
     +		["dis"]	null	System.Collections.DictionaryEntry
     +		["is_mvp"]	false	System.Collections.DictionaryEntry
     +		["effort_lv"]	1	System.Collections.DictionaryEntry
     +		["guild_name"]	null	System.Collections.DictionaryEntry
     +		["lv"]	1	System.Collections.DictionaryEntry
     +		["state"]	1	System.Collections.DictionaryEntry
     +		["rank_score"]	52	System.Collections.DictionaryEntry
     +		["sex"]	"f"	System.Collections.DictionaryEntry
     +		["rank_lv"]	"1"	System.Collections.DictionaryEntry
     +		["is_leader"]	1	System.Collections.DictionaryEntry
     +		[1]	System.Object[3]	System.Object
     +		[2]	System.Object[3]	System.Object
     +		[3]	System.Object[3]	System.Object
     +		[4]	System.Object[3]	System.Object
     +		[5]	System.Object[3]	System.Object
     +		[6]	System.Object[3]	System.Object
     +		[7]	System.Object[3]	System.Object
     + -		["user"]	{System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]}	System.Collections.DictionaryEntry
     +		["el_score"]	300	System.Collections.DictionaryEntry
     +		["gold"]	10040	System.Collections.DictionaryEntry
     +		["lv"]	1	System.Collections.DictionaryEntry
     +		["records"]	{System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]}	System.Collections.DictionaryEntry
     +		["exp"]	0	System.Collections.DictionaryEntry
     +		["coin"]	100	System.Collections.DictionaryEntry
     +		["card"]	{System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]}	System.Collections.DictionaryEntry
     +		["rank_score"]	81	System.Collections.DictionaryEntry
     + -		["battle_result"]	1	System.Collections.DictionaryEntry
     + Key	"battle_result"	System.String
     + Value	1	System.Int32
     + -		["my_data"]	System.Object[6]	System.Collections.DictionaryEntry
     + -		[0]	System.Object[3]	System.Object
     + [0]	1209	System.Object
     + [1]	1209	System.Object
     + [2]	1	System.Object
     +		[1]	System.Object[3]	System.Object
     +		[2]	System.Object[3]	System.Object
     +		[3]	System.Object[3]	System.Object
     +		[4]	System.Object[3]	System.Object
     +		[5]	System.Object[3]	System.Object
     + -		["award_id"]	"rank_win"	System.Collections.DictionaryEntry
     + -		["statementType"]	"match_Team"	System.Collections.DictionaryEntry
     */


    public override void Init()
    {
        base.Init();
        fightDataTypeChange = new List <int>();
        for (int i = 0; i < 5; i++)
        {
            fightDataTypeChange.Add(i);
        }
        userModel     = ModelManager.inst.userModel;
        roleModel     = ModelManager.inst.roleModel;
        fightModel    = ModelManager.inst.fightModel;
        shareModel    = ModelManager.inst.shareModel;
        statementType = (string)fightModel.fightData["statementType"];

        if (statementType.Equals(ModelFight.FIGHT_MATCHTEAM))
        {
            Create(Config.SCENE_FIGTHTDATA2);
        }
        else
        {
            Create(Config.SCENE_FIGTHTDATA);
        }

        btnBgUp            = "n_btn_5";
        btnBgDo            = "n_btn_6";
        textAttention      = "13013";
        textAttentiond     = "13018";
        textBtnColor       = "FFFFFF";
        textBtnStrokeColor = "#B266E0";
        textShield         = "13016";
        textShieldd        = "13032";
        fontSize           = "";



        FindObject();
        InitData();
    }
Example #14
0
    public override void Init()
    {
        GRoot.inst.touchable = false;
        base.Init();
        this.Create(Config.VIEW_AD);
        //
        fightData  = this.GetChild("n0").asImage;
        ad         = this.GetChild("n10").asImage;
        isFight    = (typeAd == ModelShare.SHARE_FIGHT);
        ad.visible = !isFight;
        //
        killAll  = this.GetChild("n3").asTextField;
        killPass = this.GetChild("n4").asTextField;
        hertAll  = this.GetChild("n5").asTextField;
        score    = this.GetChild("n6").asTextField;
        name     = this.GetChild("n7").asTextField;
        QRcode   = this.GetChild("n8").asLoader;
        //
        //

        GameObject cutCamera = new GameObject();

        cutCamera.name = "cutCamera";
        Vector3 mCa = StageCamera.main.transform.localPosition;

        camera                         = cutCamera.AddComponent <Camera> ();
        camera.clearFlags              = CameraClearFlags.SolidColor;
        camera.farClipPlane            = StageCamera.main.farClipPlane;
        camera.nearClipPlane           = StageCamera.main.nearClipPlane;
        camera.orthographic            = true;
        camera.depth                   = StageCamera.main.depth - 1;
        camera.orthographicSize        = StageCamera.main.orthographicSize;
        camera.backgroundColor         = Color.white;
        camera.transform.localPosition = new Vector3(-mCa.x, mCa.y, 0);
        camera.useOcclusionCulling     = false;
        //
        float nw = (this.width / this.height) * GRoot.inst.height;

        this.height = GRoot.inst.height;
        this.width  = nw;
        //
        this.group.x = -(GRoot.inst.width * 0.5f) - (this.width * 0.5f);
        this.group.y = 0;
//		Debug.LogError(":: >> "+this.view.width+" | "+this.view.actualWidth+" | "+this.view.viewWidth + " | "+GRoot.inst.scale.y.ToString());
        //
        userModel  = ModelManager.inst.userModel;
        shareModel = ModelManager.inst.shareModel;
        fightModel = ModelManager.inst.fightModel;
        //
        if (isFight)
        {
            object[] arr         = (object[])fightModel.fightData["my_data"];
            bool     isNotCustom = false;
            if (arr [0] is object[])
            {
                isNotCustom = true;
            }
//			Debug.Log (isNotCustom);
            if (isNotCustom)
            {
                score.text    = ((object[])arr [0]) [0] + "";
                killAll.text  = ((object[])arr [1]) [0] + "";
                killPass.text = ((object[])arr [2]) [0] + "";
                hertAll.text  = ((object[])arr [3]) [0] + "";
            }
            else
            {
                score.text    = (arr [0]) + "";
                killAll.text  = (arr [1]) + "";
                killPass.text = (arr [2]) + "";
                hertAll.text  = (arr [3]) + "";
            }
            name.text = userModel.GetUName();
        }
        //
        shareUrl = DataManager.inst.systemSimple["share_url"] + userModel.uid;
        //
        string qr = LocalStore.GetLocal(LocalStore.LOCAL_QRCODE + userModel.uid);

        if (qr != "" && qr != null && qr.Length > 0)
        {
            QRcode.texture = new NTexture(PhoneManager.inst.Base64ToTexter2d(qr, 150, 150));
            CutBitmap();
        }
        else
        {
            LoaderManager.inst.Load(shareUrl + ".jpg", (object w) => {
                if (this.group == null || this.parent == null)
                {
                    GRoot.inst.touchable = true;
                    return;
                }
                Texture2D topImage = (Texture2D)w;
                if (w != null && w != null && QRcode != null)
                {
                    if (this.group == null)
                    {
                        return;
                    }
                    QRcode.texture = new NTexture(topImage);
                    //				Log.debug("topImage:"+topImage);
                    //				Log.debug("erBg"+erBg);
                    LocalStore.SetLocal(LocalStore.LOCAL_QRCODE + userModel.uid, Convert.ToBase64String(topImage.EncodeToJPG()));
                    //				share_bitmap = ComposeImage(baseImage, topImage);
                    CutBitmap();
                }
            }, (object error) => {
                GRoot.inst.touchable = true;
            });
        }
    }
Example #15
0
    private void Record_Render_fight(int index, GObject item)
    {
        GComponent start = item.asCom.GetChild("n2").asCom;

        GLoader bg = start.GetChild("n1").asLoader;

        start.GetChild("n4").asTextField.text = "";
        GTextField rank_lv   = start.GetChild("n4").asTextField;
        GTextField killNum   = item.asCom.GetChild("n4").asTextField;
        GTextField score     = item.asCom.GetChild("n3").asTextField;
        GComponent rankScore = item.asCom.GetChild("n7").asCom;

        bool isVisible = SetListCSS(item, roleRecord, index);

        if (isVisible)
        {
            object[] dc       = (object[])roleRecord[index];
            object[] userData = null;
            int      type     = (int)dc[0];
            foreach (object[] data in (object[])dc[3])
            {
                if (data[0].ToString().Equals(roleModel.otherInfo["uid"].ToString()))
                {
                    userData = data;
                }
            }

            if (type == 1)
            {
                rankScore.visible = false;
                rank_lv.visible   = true;
                List <object> data_all = new List <object>((object[])dc[3]);
                ModelFight.Sort(data_all, 1, 2);//根据战斗积分排序
                Dictionary <string, object> myRank = fightModel.GetFightUser(data_all, roleModel.otherInfo["uid"].ToString());
                Tools.StartSetValue(start, ((int)myRank["1"] + 1).ToString());
                score.visible          = true;
                score.asTextField.text = Tools.GetMessageById("24226") + ((object[])userData[5])[0].ToString();
            }
            else
            {
                if ((bool)userData[6])
                {
                    if ((bool)userData[7])
                    {
                        //rank_lv.text = Tools.GetMessageById("24223");
                        //bg.url = Tools.GetResourceUrl("Image:icon_starmvp");
                        //Tools.SetTextFieldStrokeAndShadow(rank_lv, "#46149f", new Vector2(0, 0));
                        Tools.GetResourceUrlForMVP(bg, "mvp");
                    }
                    else
                    {
                        Tools.GetResourceUrlForMVP(bg, "win");
                    }
                }
                else
                {
                    if ((bool)userData[7])
                    {
                        //rank_lv.text = Tools.GetMessageById("24223");
                        //bg.url = Tools.GetResourceUrl("Image:icon_starmvp");
                        //Tools.SetTextFieldStrokeAndShadow(rank_lv, "#46149f", new Vector2(0, 0));
                        Tools.GetResourceUrlForMVP(bg, "mvp");
                    }
                    else
                    {
                        Tools.GetResourceUrlForMVP(bg, "lose");
                    }
                }
                score.visible     = false;
                rankScore.visible = true;
                rankScore.GetChild("n2").asTextField.text = userData[8].ToString();
                rankScore.GetChild("n1").asLoader.url     = userModel.GetRankImg(userData[8]);
            }
            //string kill=Tools.GetMessageColor("[0]" + Tools.GetMessageById("24225")+"[/0]", new string[] { "0D55AA" });
            //string kill_= Tools.GetMessageColor("[0]" + ((object[])userData[5])[1].ToString() + "[/0]", new string[] { "00478a" });
            //killNum.text = kill+kill_;
            killNum.text = Tools.GetMessageById("24225") + ((object[])userData[5])[1].ToString();
            GButton watch_fight = item.asCom.GetChild("n0").asButton;
            watch_fight.text    = Tools.GetMessageById("24224");
            watch_fight.visible = true;
            watch_fight.RemoveEventListeners();
            watch_fight.onClick.Add(() =>
            {
                fightModel.recordIndex = index;
                //roleModel.SetTabSelect(ModelRole.ROLEVIEW);
                if (type == 1)
                {
                    ViewManager.inst.ShowView <MediatorFightDataShowMatch>();
                }
                else
                {
                    ViewManager.inst.ShowView <MediatorFightDataShowRank>();
                }
            });
            GTextField date = item.asCom.GetChild("n6").asTextField;/*.text = ((DateTime)dc[3]).ToString("yyyy-MM-dd HH:mm");*/
            DateTime   time = (DateTime)dc[2];
            Tools.DataTimeFormat(date, time, 0);
        }
    }
Example #16
0
    public override void Init()
    {
        Create(Config.VIEW_FIGTHTDATASHOWMEMBER /*,false,Tools.GetMessageById("24242")*/);
        fightModel = ModelManager.inst.fightModel;
        if (fightModel.isOpenFromRecord)
        {
            fightDataDetails = (object[])fightModel.fightDataDetails[fightModel.recordIndex];
        }
        else
        {
            fightDataDetails = (object[])fightModel.fightDataDetails;
        }

        roleModel = ModelManager.inst.roleModel;
        dataAll   = (object[])fightDataDetails[3];
        myData    = (object[])dataAll[Convert.ToInt32(fightModel.openIndex)];
        GComponent comPhoto     = this.GetChild("n2").asCom;
        GTextField uname        = this.GetChild("n3").asTextField;
        GTextField guildName    = this.GetChild("n4").asTextField;
        GComponent comScoreType = this.GetChild("n7").asCom;
        GLoader    scoreTypeBG  = comScoreType.GetChild("n1").asLoader;
        GTextField scoreTypeNum = comScoreType.GetChild("n4").asTextField;
        GGroup     group        = GetChild("n25").asGroup;

        GList   list           = this.GetChild("n22").asList;
        GButton dreamAttention = this.GetChild("n23").asButton;

        dreamAttention.text = Tools.GetMessageById("13147");
        dreamAttention.onClick.Add(() => {
            if ((int)myData[0] <= 0)
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("24228"));
            }
            else
            {
                Dictionary <string, object> data1 = new Dictionary <string, object>();
                data1["fuid"] = myData[0];
                NetHttp.inst.Send(NetBase.HTTP_FOLLOW, data1, (VoHttp vo) =>
                {
                    if ((bool)vo.data == true)
                    {
                        ModelRole.attentionFight.Add(myData[0].ToString());

                        //if ((int)fightDataDetails[0] == 1)
                        //{
                        //    myData[10] = true;
                        //}
                        //else
                        //{
                        //    myData[13] = true;
                        //}


                        ViewManager.inst.ShowText(Tools.GetMessageById("13045"));
                        dreamAttention.visible = false;
                    }
                    else
                    {
                        ViewManager.inst.ShowText(Tools.GetMessageById("13120"));
                    }
                });
            }
        });
        object[] fightDta = (object[])myData[5];
        deck = (object[])myData[4];

        userModel = ModelManager.inst.userModel;
        userModel.GetUnlcok(Config.UNLOCK_GUILD, guildName);

        //                [0]	-82	System.Object
        //[1]	"勇敢的龙骑士"	System.Object
        //[2]	9	System.Object
        //[3]	5	System.Object
        //[4] System.Object[8] System.Object
        //[5] System.Object[6] System.Object
        // [6] false	System.Object
        // [7] true	System.Object
        //[8] Count= 1 System.Object
        // [9] null	System.Object
        // [10]    null	System.Object

        list.itemRenderer = OnRender;
        list.numItems     = deck.Length;
        if (!Tools.IsNullEmpty(myData[1]))
        {
            uname.text = myData[1].ToString();
        }
        else
        {
            uname.text = myData[0].ToString();
        }
        comPhoto.GetChild("n2").asTextField.text = myData[2].ToString();
        GButton head = comPhoto.GetChild("n0").asButton;

        head.onClick.Add(OpenUser);

        if ((int)fightDataDetails[0] == 1)
        {
            //comScoreType.visible = false;
            group.visible = false;
            if ((int)myData[0] > 0)
            {
                Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(((Dictionary <string, object>)myData[6])["use"].ToString()));
            }
            else
            {
                Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(myData[1].ToString(), false, true));
            }
            if (!Tools.IsNullEmpty(myData[8]))
            {
                guildName.text = myData[8].ToString();
            }
            else
            {
                guildName.text = Tools.GetMessageById("19955");
            }
            scoreTypeNum.text = fightModel.recordIndex.ToString();
            Debug.Log((bool)myData[10]);
            if (!(bool)myData[10])//是否关注
            {
                if (!(bool)myData[11])
                {
                    if ((bool)myData[9])
                    {
                        if (myData[0].ToString().Equals(userModel.uid))
                        {
                            dreamAttention.visible = false;
                        }
                        else
                        {
                            if (ModelRole.attentionFight.Contains(myData[0].ToString()))
                            {
                                dreamAttention.visible = false;
                            }
                            else
                            {
                                dreamAttention.visible = true;
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if ((bool)myData[7])
            {
                //comScoreType.visible = true;
                group.visible = true;

                //scoreTypeBG.url = Tools.GetResourceUrl("Image2:n_icon_paiming0");
                //scoreTypeNum.text = Tools.GetMessageById("24223");
                Tools.GetResourceUrlForMVP(scoreTypeBG, "mvp");
            }
            else
            {
                //comScoreType.visible = false;
                group.visible = false;
            }

            if ((int)myData[0] > 0)
            {
                Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(((Dictionary <string, object>)myData[9])["use"].ToString()));
            }
            else
            {
                Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(myData[1].ToString(), false, true));
            }
            if (!Tools.IsNullEmpty(myData[11]))
            {
                guildName.text = myData[11].ToString();
            }
            else
            {
                guildName.text = Tools.GetMessageById("19955");
            }
            Debug.Log((bool)myData[13]);
            if (!(bool)myData[13])//是否关注
            {
                if (!(bool)myData[14])
                {
                    if ((bool)myData[12])
                    {
                        if (myData[0].ToString().Equals(userModel.uid))
                        {
                            dreamAttention.visible = false;
                        }
                        else
                        {
                            if (ModelRole.attentionFight.Contains(myData[0].ToString()))
                            {
                                dreamAttention.visible = false;
                            }
                            else
                            {
                                dreamAttention.visible = true;
                            }
                        }
                    }
                }
            }
        }
    }
    public override void Init()
    {
        base.Init();
        Create(Config.SCENE_FIGTHTBOX);
        userModel  = ModelManager.inst.userModel;
        roleModel  = ModelManager.inst.roleModel;
        fightModel = ModelManager.inst.fightModel;

        initQueue       = new FunQueue();
        viewFight       = this.GetChild("n0").asCom;
        viewFight.scale = new Vector2(0.8f, 0.8f);
        rankScore       = viewFight.GetChild("n2").asCom;
        openTitle       = viewFight.GetChild("n3").asTextField;
        rankImg         = this.GetChild("n2").asLoader;
        mask            = this.GetChild("n1").asGraph;
        g1 = this.GetChild("n5").asGraph;
        g2 = this.GetChild("n3").asGraph;
        g3 = this.GetChild("n4").asGraph;
        g4 = this.GetChild("n7").asGraph;
        g5 = this.GetChild("n10").asGraph;
        g6 = this.GetChild("n37").asGraph;
        AddGlobalListener(MainEvent.EXPLORE_GIFT, OpenView);
        openTitle.text = Tools.GetMessageById("24209");
        rankScoreBg    = rankScore.GetChild("n1").asLoader;
        rankScoreValue = rankScore.GetChild("n2").asTextField;
        addRankScore   = viewFight.GetChild("n4").asTextField;
        tip            = this.GetChild("n8").asTextField;
        mvp            = this.GetChild("n9").asCom;
        //mvp.GetChild("n4").asTextField.text = Tools.GetMessageById("24223");
        GLoader mvp_ = mvp.GetChild("n1").asLoader;

        Tools.GetResourceUrlForMVP(mvp_, "mvp");
        mvp.visible = false;

        //effectType1 = Config.EFFECT_LOSE;
        //animateType1 = "mvp";
        //animateDir1 = "los/lose_";
        //animateType1_go = EffectManager.inst.AddEffect(effectType1, animateType1, g1, null, false, 75, animateDir1);
        //GameObject go = Tools.GetPrefab("Effect/" + effectType1);
        //GameObject go1 = go.transform.Find(animateDir1 + "/pPlane11" + "/pPlane12").gameObject;
        //GameObject go2 = go1.transform.Find("text").gameObject;
        //GTextField text = new GTextField();
        //text.x = go2.transform.position.x;
        //text.y = go2.transform.position.y;
        //text.text = "mvp";
        //go2.AddComponent<MeshFilter>();
        //go2.AddComponent<MeshRenderer>();
        //view.AddChild(text);



        //rankScoreBg = rankScore.GetChild("n1").asLoader;
        //rankScoreValue = rankScore.GetChild("n2").asTextField;
        //addRankScore = viewFight.GetChild("n4").asTextField;
        //rankScoreValue.text = "0";
        //rankScoreStart = 150;
        //rankScoreEnd = 50 /*(int)info["rank_score"]*/;
        //num = Math.Abs(rankScoreStart - rankScoreEnd);
        //addRankScore.text = "+" + 100;
        //rankScoreBg.url = userModel.GetRankImg(rankScoreStart);
        //rankImg.url = userModel.GetRankImg(rankScoreStart);
        //rankScoreValue.text = "100";
        //switch (isRankUp(rankScoreEnd))
        //{
        //    case 0:
        //        addRankScore.text = "+" + num;
        //        break;
        //    case 1:
        //        addRankScore.text = "-" + num;
        //        break;
        //}

        //effectType1 = Config.EFFECT_WIN;

        //animateType1 = null;
        //animateDir1 = null;
        //isMvp = true;

        //rewardName = "Bag102/bag102";
        //effectType2 = "Bag102/bag102";
        //animateType2 = "102";
        //animateDir2 = null;

        //initQueue.Init(new List<Action> {
        //    Effect1,
        //    Effect2,
        //    Effect3,
        //    Effect4,
        //    Effect5,
        //    Effect6
        //});
        InitData();
    }
    private void InitData()
    {
        fight_tag = fightModel.GetFightTag();
        result    = (object[])fightModel.fightData["result"];
        myData    = (object[])fightModel.fightData["my_data"];
        data_all  = new List <object>(result);

        if (statementType.Equals(ModelFight.FIGHT_MATCHTEAM) || statementType.Equals(ModelFight.FIGHT_FREEMATCH2))
        {
            for (int i = 0; i < data_all.Count; i++)
            {
                if (data_all[i] != null)
                {
                    if (!((Dictionary <string, object>)((object[])data_all[i])[2]).ContainsKey("rankLevel"))
                    {
                        ((Dictionary <string, object>)((object[])data_all[i])[2]).Add("rankLevel", i);
                    }
                }
            }
        }
        ModelFight.Sort(data_all, 1, 1);//根据战斗积分排序
        myRank = fightModel.GetFightUser(data_all, userModel.uid);
        user   = (object[])myRank["0"];
        if ((int)myRank["1"] < 3)
        {
            if (data_all.Count != 1)
            {
                Debug.Log(data_all.Count);
                listData = data_all.GetRange(0, 3);
                //list.x = 250;
            }
            else
            {
                listData = data_all.GetRange(0, 1);
                //list.x = 250;
            }
        }
        else
        {
            listData = data_all.GetRange(0, 3);
            listData.Add(user);
        }
        //foreach(object obj in listData)
        //{
        //    if (obj == null) {
        //        listData.Remove(obj);
        //    }
        //}
        for (var i = 0; i < listData.Count; i++)
        {
            if (listData[i] == null)
            {
                listData.RemoveAt(i);
                --i;
            }
        }

        list.itemRenderer = OnRenderer;
        list.numItems     = listData.Count;
        Log.debug("人数:" + listData.Count);
    }
Example #19
0
    public override void Init()
    {
        base.Init();
        this.isAutoClose = false;
        this.Create(Config.VIEW_TEAMMATCH, false);

//		PlatForm.inst.timeout = 20000f;

        fightModel = ModelManager.inst.fightModel;
        roleModel  = ModelManager.inst.roleModel;
        userModel  = ModelManager.inst.userModel;

        fightModel.fightType = ModelFight.FIGHT_MATCHTEAM;

        list           = this.GetChild("n2").asList;
        btn_Enter      = this.GetChild("n3").asButton;
        btn_Enter.text = Tools.GetMessageById("25062");
        btn_Invite     = this.GetChild("n4").asButton;
        c1             = this.GetController("c1");
        text1          = this.GetChild("n7").asTextField;
        text2          = this.GetChild("n8").asTextField;

        text3 = this.GetChild("n9").asTextField;
        //
        btn_Cancel      = this.GetChild("n6").asButton;
        btn_Cancel.text = Tools.GetMessageById("14025");
        btn_Quit        = this.GetChild("n29").asTextField;
        btn_Chat        = this.GetChild("n18").asButton;
        //btn_Chat.text = Tools.GetMessageById("25067");
        btn_Mil = this.GetChild("n19").asButton;
        btn_Mil.GetChild("n2").asTextField.text = Tools.GetMessageById("25067");
        bar      = this.GetChild("n20").asCom as ComProgressBar;
        bar.skin = ComProgressBar.BAR10;
        bar.SetTextVisible(false);
        bar.value = 0;
        bar.max   = 100;

        btn_Close = this.GetChild("close").asButton;
        btn_Close.onClick.Add(this.Close);
        //
        this.GetChild("title").asTextField.text = Tools.GetMessageById("25033");
        //
        btn_Enter.onClick.Add(Enter_Click);
        btn_Invite.onClick.Add(Invite_Click);
        btn_Cancel.onClick.Add(Cancel_Click);
//		btn_Quit.onClick.Add (Quit_Click);
        btn_Quit.text = Tools.GetMessageById("25058");
        btn_Chat.onClick.Add(Chat_Click);
        btn_Mil.onClick.Add(Chat_Click_Over);
        fightModel.isMatch = false;

        //麦克风功能
        micro = new MediatorMicro();
        ViewManager.inst.AddTopView(micro);
        //房间内部操作
        NetSocket.inst.AddListener(NetBase.SOCKET_TEAMMATCH, (VoSocket vo) =>
        {
//				Debug.LogError("NetSocket.inst.AddListener");
            if (vo.data is Boolean)
            {
                bool isOk = Convert.ToBoolean(vo.data);
                if (!isOk)
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("25026"));
                    TimerManager.inst.Remove(Time_Tick);
                    fightModel.isMatch = false;
                    list.numItems      = 4;
                    if (fightModel.isLeader)
                    {
                        c1.selectedIndex = 0;
                    }
                    else
                    {
                        c1.selectedIndex = 1;
                    }
                }
            }
            else
            {
                Dictionary <string, object> data = (Dictionary <string, object>)vo.data;
                fightModel.team1 = (object[])data ["team"];
                list.numItems    = 4;             //fightModel.team1.Length;

                c1.selectedIndex = 4;
                this.closeEnable = false;
                text3.text       = Tools.GetMessageById("25064");
                TimerManager.inst.Add(5f, 1, (float t) =>
                {
                    TimerManager.inst.Remove(Time_Tick);
                    c1.selectedIndex = 4;
                    //					Log.debug ("准备开始 - " + vo.data.ToString ());

                    DispatchManager.inst.Dispatch(new MainEvent(MainEvent.START_FIGHT, data));
                });
            }
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_STARTMATCHPUSH, (VoSocket vo) =>
        {
            fightModel.isMatch = true;
            list.numItems      = 4;       //fightModel.team1.Length;

//			NetSocket.inst.RemoveListener (NetBase.SOCKET_STARTMATCH);
            if (fightModel.isLeader)
            {
                c1.selectedIndex = 2;
            }
            else
            {
                c1.selectedIndex = 3;
            }

            fightModel.preTime   = Convert.ToInt32(vo.data);
            fightModel.matchTime = 0;
//			Log.debug ("开始匹配 - " + fightModel.preTime.ToString ());
            if (fightModel.isLeader)
            {
                text1.text = Tools.GetMessageById("25005", new string[] {
                    fightModel.preTime.ToString(),
                    fightModel.matchTime.ToString()
                });
            }
            else
            {
                text2.text = Tools.GetMessageById("25005", new string[] {
                    fightModel.preTime.ToString(),
                    fightModel.matchTime.ToString()
                });
            }
            TimerManager.inst.Add(1f, 0, Time_Tick);
//			ViewManager.inst.ShowText (Tools.GetMessageById ("25013"));
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_ACCEPTINVITEOTHER, (VoSocket vo) =>
        {
            string uid    = fightModel.AddTeam(vo.data);
            list.numItems = 4;            //fightModel.team1.Length;
            ViewManager.inst.ShowText(Tools.GetMessageById("25012", new String[] { uid }));
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_KILLTEAMPUSH, (VoSocket vo) =>
        {
            fightModel.Clear();
            ViewManager.inst.CloseView(this);
            ViewManager.inst.ShowText(Tools.GetMessageById("25008"));
//			Log.debug ("解散队伍 - " + vo.data.ToString ());
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_QUITTEAMPUSH, (VoSocket vo) =>
        {
//			if (vo.data is Boolean && !Convert.ToBoolean (vo.data))
//			{
//				ViewManager.inst.ShowText (Tools.GetMessageById ("25016"));
//				return;
//			}
            string uid = vo.data.ToString();
            if (userModel.uid == uid)
            {
                ViewManager.inst.CloseView(this);
                ViewManager.inst.ShowText(Tools.GetMessageById("25011"));
//				Log.debug ("退出队伍 - " + vo.data.ToString ());
            }
            else
            {
                fightModel.ChangeTeam(vo.data);
                list.numItems = 4;
                if (fightModel.isLeader)
                {
                    c1.selectedIndex = 0;
                }
                else
                {
                    c1.selectedIndex = 1;
                }
                this.btn_Enter.enabled = false;
                TimerManager.inst.Add(2f, 1, (float t) =>
                {
                    this.btn_Enter.enabled = true;
                });
            }
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_CANCELMATCHPUSH, (VoSocket vo) =>
        {
            if (!Convert.ToBoolean(vo.data))
            {
                return;
            }
            fightModel.isMatch = false;
            if (fightModel.isLeader)
            {
                c1.selectedIndex = 0;
            }
            else
            {
                c1.selectedIndex = 1;
            }
            TimerManager.inst.Remove(Time_Tick);
            ViewManager.inst.ShowText(Tools.GetMessageById("25015"));
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_MATCHTEAMCHATPUSH, (VoSocket vo) =>
        {
            if (userModel.IsChatVoice())
            {
                fightModel.AddMicro(vo.data);
            }
        });

        this.AddGlobalListener(MainEvent.SOCKET_CLOSE, (MainEvent e) =>
        {
            this.Close();
        });
        //
        this.InitData();
    }
 public override void Init()
 {
     base.Init();
     this.Create(Config.VIEW_INVITEALERT);
     fightModel = ModelManager.inst.fightModel;
 }
    public override void Init()
    {
        base.Init();
        string myUid = "";

        fightModel           = ModelManager.inst.fightModel;
        roleModel            = ModelManager.inst.roleModel;
        userModel            = ModelManager.inst.userModel;
        playbackfailure_time = (int)DataManager.inst.systemSimple["playbackfailure_time"];
        video_deadline       = (DateTime)DataManager.inst.systemSimple["video_deadline"];
        if (fightModel.isOpenFromRecord)
        {
            myUid            = roleModel.otherInfo["uid"].ToString();
            fightDataDetails = (object[])fightModel.fightDataDetails[fightModel.recordIndex];
            Create(Config.VIEW_FIGTHTDATASHOWRANK, false, (string)roleModel.otherInfo["uname"] + Tools.GetMessageById("24224"));
        }
        else
        {
            myUid            = fightModel.myUid;
            fightDataDetails = (object[])fightModel.fightDataDetails;
            Create(Config.VIEW_FIGTHTDATASHOWRANK, false, fightDataDetails[fightDataDetails.Length - 1].ToString() + Tools.GetMessageById("24224"));
        }

        listData = new List <object[]>();
        GTextField t1    = this.GetChild("n15").asTextField;
        GTextField t2    = this.GetChild("n16").asTextField;
        GTextField text1 = this.GetChild("n5").asTextField;
        GTextField text2 = this.GetChild("n7").asTextField;
        GTextField text3 = this.GetChild("n4").asTextField;
        GTextField text4 = this.GetChild("n6").asTextField;

        timeFail = this.GetChild("n39").asTextField;
        GTextField value1 = this.GetChild("value1").asTextField;
        GTextField value2 = this.GetChild("value2").asTextField;
        GTextField value3 = this.GetChild("value3").asTextField;
        GTextField value4 = this.GetChild("value4").asTextField;

        list1 = this.GetChild("n3").asList;
        list2 = this.GetChild("n13").asList;
        share = this.GetChild("n17").asButton;
        watch = this.GetChild("n18").asButton;
        bool ok = userModel.GetUnlcok(Config.UNLOCK_FIGHTSHARE, share);

        if (!ok)
        {
            watch.x = 377;
        }
        //share.asCom.GetChild("n1").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_you1");
        share.text = Tools.GetMessageById("24219");
        share.RemoveEventListeners();
        share.onClick.Add(ShareOnclick);

        //watch.asCom.GetChild("n1").asLoader.url = Tools.GetResourceUrl("Image2:n_icon_you2");
        watch.text = Tools.GetMessageById("24248");
        watch.RemoveEventListeners();
        watch.onClick.Add(WatchOnclick);
        //share.visible = true;
        if (fightModel.isOpenFromRecord)
        {
            if (!myUid.Equals(userModel.uid))
            {
                share.visible = false;
                watch.visible = false;
            }
            else
            {
                if (!TimeFail())
                {
                    share.visible    = false;
                    watch.visible    = false;
                    timeFail.visible = true;
                    timeFail.text    = Tools.GetMessageById("10038");
                }
            }
        }
        else
        {
            share.visible = false;
        }

        dataAll = (object[])fightDataDetails[3];
        for (int i = 0; i < dataAll.Length; i++)
        {
            object[] data = (object[])dataAll[i];
            if (data[0].ToString().Equals(myUid))
            {
                dataMe  = (object[])data[5];
                myIndex = i;
            }
            listData.Add(data);
        }
        string str1   = Tools.GetMessageById("24231") + ":";
        string str1_1 = dataMe[0].ToString();
        string str2   = Tools.GetMessageById("24213") + ":";
        string str2_1 = dataMe[3].ToString();
        string str3   = Tools.GetMessageById("24211") + ":";
        string str3_1 = dataMe[1].ToString();
        string str4   = Tools.GetMessageById("24212") + ":";
        string str4_1 = dataMe[2].ToString();

        t1.text     = Tools.GetMessageById("24249");
        t2.text     = Tools.GetMessageById("24250");
        text1.text  = str1;
        text2.text  = str2;
        text3.text  = str3;
        text4.text  = str4;
        value1.text = str1_1;
        value2.text = str2_1;
        value3.text = str3_1;
        value4.text = str4_1;
        if (myIndex <= 3)
        {
            listData1 = listData.GetRange(0, 4);
            listData2 = listData.GetRange(4, 4);
        }
        else
        {
            listData1 = listData.GetRange(4, 4);
            listData2 = listData.GetRange(0, 4);
        }
        list1.itemRenderer = OnRender_1;
        list1.numItems     = listData1.Count;
        list2.itemRenderer = OnRender_2;
        list2.numItems     = listData2.Count;
    }
Example #22
0
    public override void Init()
    {
        base.Init();
        this.isAutoClose = false;
        this.Create(Config.VIEW_FREEMATCH, false, Tools.GetMessageById("25024"));

        fightModel           = ModelManager.inst.fightModel;
        userModel            = ModelManager.inst.userModel;
        fightModel.fightType = ModelFight.FIGHT_FREEMATCH1;

//		PlatForm.inst.timeout = 2f;

//		title = view.GetChild ("n1").asTextField;
        btn_Change = this.GetChild("n2").asButton;
        btn_Start  = this.GetChild("n12").asButton;
        btn_Invite = this.GetChild("n13").asButton;

        btn_Change.text = Tools.GetMessageById("33209");
        btn_Start.text  = Tools.GetMessageById("33210");
        btn_Invite.text = Tools.GetMessageById("33211");

        btn_Quit = this.GetChild("n16").asButton;
        btn_Clos = this.GetChild("n31").asButton;
        btn_Bot  = this.GetChild("n11").asButton;
        btn_Chat = this.GetChild("n19").asButton;
        c1       = this.GetController("c1");
        btn_Mil  = this.GetChild("n28").asButton;
        bar      = this.GetChild("n29").asCom as ComProgressBar;
        bar.skin = ComProgressBar.BAR10;
        bar.SetTextVisible(false);
        bar.value = 0;
        bar.max   = 100;

        item0 = this.GetChild("n3").asCom;
        item1 = this.GetChild("n4").asCom;
        item2 = this.GetChild("n5").asCom;
        item3 = this.GetChild("n6").asCom;
        item4 = this.GetChild("n7").asCom;
        item5 = this.GetChild("n8").asCom;
        item6 = this.GetChild("n9").asCom;
        item7 = this.GetChild("n10").asCom;
        help  = this.GetChild("n30").asButton;

        btn_Invite.onClick.Add(Invite_Click);
        btn_Clos.onClick.Add(Close_Click);
        btn_Change.onClick.Add(Change_Click);
        btn_Start.onClick.Add(Start_Click);
        btn_Bot.onClick.Add(Bot_Click);
        btn_Chat.onClick.Add(Chat_Click);
        btn_Quit.onClick.Add(Close_Click);
        help.onClick.Add(Help_Click);

        userModel.GetUnlcok(Config.UNLOCK_FREEMATCH2, btn_Change);

//		public int[] freeType1 = new int[]{ 0, 1, 2, 3, 4, 5, 6, 7 };
//		public int[] freeType2 = new int[]{ 0, 1, 4, 5, 2, 3, 6, 7 };
        if (fightModel.freeType == 1)
        {
            items = new GComponent[8] {
                item0, item1, item2, item3, item4, item5, item6, item7
            }
        }
        ;
        else
        {
            items = new GComponent[8] {
                item0, item1, item4, item5, item2, item3, item6, item7
            }
        };
        this.SetDefault();
        if (fightModel.isRequest)
        {
            NetSocket.inst.AddListener(NetBase.SOCKET_NEWROOM, (VoSocket vo) =>
            {
                NetSocket.inst.RemoveListener(NetBase.SOCKET_NEWROOM);
                fightModel.CreateFreeTeam(vo.data);
                UpdateItems();
                CheckMode();
                btn_Bot.visible = fightModel.isLeader;
            });

            Dictionary <string, object> data = new Dictionary <string, object> ();
            data ["mode"] = fightModel.freeType;
            NetSocket.inst.Send(NetBase.SOCKET_NEWROOM, data);
        }
        else
        {
            CheckMode();
            UpdateItems();
            btn_Bot.visible = fightModel.isLeader;
        }

        micro = new MediatorMicro();
        ViewManager.inst.AddTopView(micro);
//		micro.visible = false;

        NetSocket.inst.AddListener(NetBase.SOCKET_ADDUSER, (VoSocket vo) =>
        {
            fightModel.ChangeFreeTeam(vo.data);
            UpdateItems();
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_REMOVEUSER, (VoSocket vo) =>
        {
            bool b = fightModel.DelFreeTeam(vo.data);
            if (b)
            {
                fightModel.Clear();
                ViewManager.inst.CloseView(this);
                ViewManager.inst.ShowText(Tools.GetMessageById("25011"));
            }
            else
            {
                UpdateItems();
            }
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_KILLROOMPUSH, (VoSocket vo) =>
        {
            fightModel.Clear();
            ViewManager.inst.CloseView(this);
            ViewManager.inst.ShowText(Tools.GetMessageById("25008"));
            Log.debug("解散队伍");
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_FREESTARTMATCHPUSH, (VoSocket vo) =>
        {
            if (fightModel.freeType == 1)
            {
                fightModel.fightType = ModelFight.FIGHT_FREEMATCH1;
            }
            else
            {
                fightModel.fightType = ModelFight.FIGHT_FREEMATCH2;
            }
            Log.debug("进入战斗");
            ViewManager.inst.ShowScene <MediatorFightWorld> (true);
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_CHANGEMODEPUSH, (VoSocket vo) =>
        {
            Dictionary <string, object> da = (Dictionary <string, object>)vo.data;
            fightModel.freeType            = Convert.ToInt32(da ["new_mode"]);
            CheckMode(true);
            Log.debug("更换模式");
//			ViewManager.inst.ShowText (Tools.GetMessageById ("25021"));
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_CHANGEPOSPUSH, (VoSocket vo) =>
        {
            fightModel.RepalceFreeTeam(vo.data);
            CheckMode(true);
            Log.debug("更换位置");
//			ViewManager.inst.ShowText (Tools.GetMessageById ("25021"));
        });

        NetSocket.inst.AddListener(NetBase.SOCKET_FREECHATPUSH, (VoSocket vo) =>
        {
            if (userModel.IsChatVoice())
            {
                fightModel.AddMicro(vo.data);
            }
        });

        this.AddGlobalListener(MainEvent.SOCKET_CLOSE, (MainEvent e) =>
        {
            this.Close();
        });
    }