Example #1
0
    public override void OnShow()
    {
        base.OnShow();
        roomIdLabel.text = string.Empty;
        for (int i = 4; i < playerGos.Length; ++i)
        {
            playerGos[i].transform.Find("Portrait").GetComponent <UIEventListener>().onClick = OnWatchPlayerClick;
        }

        for (int i = 0; i < player1V1.Length; ++i)
        {
            player1V1[i].transform.Find("Portrait").GetComponent <UIEventListener>().onClick = OnNormalPlayerClick;
        }

        for (int i = 0; i < player2V2.Length; ++i)
        {
            player2V2[i].transform.Find("Portrait").GetComponent <UIEventListener>().onClick = OnNormalPlayerClick;
        }

        for (int i = 0; i < player3H.Length; ++i)
        {
            player3H[i].transform.Find("Portrait").GetComponent <UIEventListener>().onClick = OnNormalPlayerClick;
        }

        for (int i = 0; i < player4H.Length; ++i)
        {
            player4H[i].transform.Find("Portrait").GetComponent <UIEventListener>().onClick = OnNormalPlayerClick;
        }

        UISystem.Get().ShowWindow("FriendMembersWindow");
        startBtn.gameObject.SetActive(false);
        showWatchPlayer = false;
        ShowWatch(true);
    }
Example #2
0
 /// <summary>
 /// 好友
 /// </summary>
 public void OnClickFriends()
 {
     /* Tips.Make(Tips.TipsType.FlowUp, LanguageDataProvider.GetValue(602), 1.0f);
      * return;*/
     UISystem.Get().HideAllWindow();
     UISystem.Get().ShowWindow("FriendWindow");
 }
Example #3
0
 public void OnGoHomeClick()
 {
     BattleSystem.Instance.Reset();
     BattleSystem.Instance.battleData.resumingFrame = -1;
     UISystem.Get().HideAllWindow();
     UISystem.Get().ShowWindow("StartWindow");
 }
Example #4
0
 /// <summary>
 /// 异常结束pvp战斗
 /// </summary>
 public void FinishPvpBattle()
 {
     BattleSystem.Instance.Reset();
     UISystem.Get().HideAllWindow();
     UISystem.Get().ShowWindow("LobbyWindowView");
     EventSystem.Instance.FireEvent(EventId.UpdateChaptersWindow, 1);
 }
Example #5
0
    public void OnConfirmClick()
    {
        string name = inputField.value;

        if (string.IsNullOrEmpty(name))
        {
            Tips.Make(LanguageDataProvider.GetValue(10));

            return;
        }
        //判断是否有敏感字符
        bool nameIllegal = false;

        nameIllegal = NameFilterConfigProvider.Instance.nameCheck(name);
        if (nameIllegal)
        {
            Tips.Make(LanguageDataProvider.GetValue(1114));
            return;
        }
        // GuideManager.TriggerGuideEnd(GuildEndEvent.rename);
        NetSystem.Instance.helper.ChangeName(name);

        // 本地存储玩家名称
        LocalPlayer.Get().playerData.name = inputField.value;
        LocalAccountStorage.Get().name = inputField.value;
        LocalStorageSystem.Instance.SaveLocalAccount();

        // 进入PVP界面
        UISystem.Get().HideWindow("SingleClearWindow");
        EventSystem.Instance.FireEvent(EventId.UpdateChaptersWindow);
    }
Example #6
0
    // 发送退出战斗指令
    public void QuitBattle(bool finish = false)
    {
        //Debug.LogFormat ("QuitBattle   finished:{0}", finish);

        battleSystem.StopLockStep();

        #if !SERVER
        if (UISystem.Instance.IsWindowVisible("ResumingWindow"))
        {
            UISystem.Instance.HideWindow("ResumingWindow");
        }

        if (finish)
        {
            UISystem.Get().ShowWindow("BattleEndWindow");
            // 闪白
            Team winTeam = BattleSystem.Instance.sceneManager.teamManager.GetTeam(battleData.winTEAM);
            //Debug.Log ("闪白的队伍:" + winTeam.team + "    name:" + winTeam.playerData.name);
            Color winColor = winTeam.color;
            BattleSystem.Instance.sceneManager.ShowWinEffect(winTeam, winColor);
            EventSystem.Instance.FireEvent(EventId.OnFinishedColor, winTeam.color, winTeam);
        }
        else
        {
            // 观战模式战斗中退出不需要结果界面
            if (battleData.gameState != GameState.Watcher)
            {
                UISystem.Get().ShowWindow("BattleEndWindow");
            }
        }
        #endif

        if (battleData.isReplay)
        {
        }
        else
        {
            // 直接从这儿设置状态为战斗结束
            battleSystem.battleData.gameState = GameState.GameEnd;

            //发送消息
            NetMessage.CSQuitBattle quit = new NetMessage.CSQuitBattle();
            //System.Text.StringBuilder sb = new System.Text.StringBuilder ();
            for (int i = 0; i < battleEndDatas.Count; ++i)
            {
                BattleEndData       data = battleEndDatas[i];
                NetMessage.EndEvent e    = new NetMessage.EndEvent();
                e.userid      = data.userId;
                e.end_type    = data.endType;
                e.end_frame   = data.endFrame;
                e.end_destroy = data.destroy;
                e.end_survive = data.survive;
                quit.events.Add(e);

                //sb.Append (string.Format ("[{0},{1},{2},{3}];", data.userName, data.userId, data.endType, data.endFrame));
            }
            NetSystem.Instance.Send <NetMessage.CSQuitBattle>((int)NetMessage.MsgId.ID_CSQuitBattle, quit);
        }
    }
Example #7
0
 public void OnLeagueConfirmClick()
 {
     // 回到联赛主页面
     BattleSystem.Instance.Reset();
     UISystem.Get().HideAllWindow();
     UISystem.Get().ShowWindow("CustomSelectWindowNew");
     EventSystem.Instance.FireEvent(EventId.OnManualSelectLeaguePage);
 }
Example #8
0
 public override void OnShow()
 {
     base.OnShow();
     UISystem.Get().ShowWindow("FriendMembersWindow");
     SetPlayerBaseInfo();
     SetSelfInfo(self);
     SetPlayerInfo(player, null);
 }
Example #9
0
    public void OnNoClick()
    {
        if (onNo != null)
        {
            onNo.Execute();
        }

        UISystem.Get().HideWindow("CommonNoticeWindow");
    }
Example #10
0
    void Start()
    {
        percent = 1;
        SetPercent();
        // 设置drag参数的像素修正
        UIRoot nguiRoot = UISystem.Get().GetNGUIRoot();

        sensitive *= nguiRoot.pixelSizeAdjustment;
    }
Example #11
0
 public void GiveUpOnClicked()
 {
     //Pause();
     if (!BattleSystem.Instance.IsPause())
     {
         BattleSystem.Instance.SetPause(true);
     }
     UISystem.Get().ShowWindow("CommonDialogWindow");
     UISystem.Get().OnEventHandler((int)EventId.OnCommonDialog, "CommonDialogWindow",
                                   2, LanguageDataProvider.GetValue(1104), new EventDelegate(GiveUp), new EventDelegate(PauseCancel));
 }
Example #12
0
    public void OnYesClick()
    {
        if (onYes != null)
        {
            onYes.Execute();
        }

        if (type != 4)
        {
            UISystem.Get().HideWindow("CommonNoticeWindow");
        }
    }
Example #13
0
 /// <summary>
 /// 开始PVP战斗
 /// </summary>
 public void JoinGameOnClicked()
 {
     UISystem.Get().HideAllWindow();
     UISystem.Get().ShowWindow("PvPRoomWindow");
     //if( NetSystem.Instance.GetConnector().GetConnectStatus() != ConnectionStatus.CONNECTED )
     //{
     //    UISystem.Instance.ShowWindow("ReconnectWindow");
     //}
     //else
     //{
     //    JoinGame();
     //}
 }
Example #14
0
 public void OnCloseClick()
 {
     UISystem.Get().ShowWindow("LobbyWindowView");
     UISystem.Get().HideWindow("SettingWindow");
     if (LocalSettingStorage.Get().lobbyWindowType == 0)
     {
         EventSystem.Instance.FireEvent(EventId.UpdateChaptersWindow);
     }
     else if (LocalSettingStorage.Get().lobbyWindowType == 1)
     {
         EventSystem.Instance.FireEvent(EventId.UpdateChapterWindow, 3);
     }
 }
Example #15
0
 public void FinishPvp()
 {
     if (haveResult)
     {
         UISystem.Get().HideWindow("BattleEndWindow");
         UISystem.Get().HideWindow("BattleWindow");
         UISystem.Get().HideWindow("ReplayBattleWindow");
         UISystem.Get().ShowWindow("ResultWindow");
         EventSystem.Instance.FireEvent(EventId.OnFinished, proto);
     }
     else
     {
         Invoke("FinishPvpBattle", 0.5f);
     }
 }
Example #16
0
    public void OnClickEnglish(GameObject go)
    {
        AudioManger.Get().PlayEffect("click_down");
        SystemLanguage curLanguage = (SystemLanguage)LocalAccountStorage.Get().localLanguage;

        if (curLanguage == SystemLanguage.English)
        {
            return;
        }

        SelectLanguage = SystemLanguage.English;
        UISystem.Get().ShowWindow("CommonDialogWindow");
        UISystem.Get().OnEventHandler((int)EventId.OnCommonDialog, "CommonDialogWindow",
                                      2, LanguageDataProvider.GetValue(208), new EventDelegate(ModifyLanguange));
    }
Example #17
0
    private void StartGame()
    {
        GameType  gameType  = BattleSystem.Instance.battleData.gameType;
        GameState gameState = BattleSystem.Instance.battleData.gameState;

        if (BattleSystem.Instance.battleData.isReplay)
        {
            UISystem.Get().ShowWindow("ReplayBattleWindow");
        }
        else if (gameType == GameType.PVP || gameType == GameType.League)
        {
            if (BattleSystem.Instance.battleData.gameState == GameState.Watcher)
            {
                UISystem.Get().ShowWindow("ReplayBattleWindow");
                EventSystem.Instance.FireEvent(EventId.ShowForWatchMode);
            }
            else
            {
                // PVP战斗界面
                UISystem.Get().ShowWindow("BattleWindow");
            }
        }
        else if (gameType == GameType.Single || gameType == GameType.PayLevel || gameType == GameType.TestLevel)
        {
            // 单机;;;虽然单机不走preview了
            UISystem.Get().ShowWindow("BattleWidnow_off");
        }

        // 进入战斗
//		UISystem.Get ().FadeBattle(true, new EventDelegate (()=>{

//			BattleSystem.Instance.StartLockStep();
//			// 需要恢复
////			if (BattleSystem.Instance.battleData.resumingFrame > 0)
////			{
////				UISystem.Instance.ShowWindow ("ResumingWindow");
////			}
//		}));

        // 首先隐藏飞船
        //ShipFadeManager.Get().SetShipAlpha( 0.0f );

        UISystem.Get().HideWindow("PreviewWindow");

        EventSystem.Instance.FireEvent(EventId.NoticeSelfTeam);
    }
Example #18
0
    /// <summary>
    /// 创建场景
    /// </summary>
    public void CreateScene(IList <int> usr, bool isEditer = false, bool isHaveRandom = false)
    {
        MapConfig table = MapConfigProvider.Instance.GetData(battleData.matchId);

        if (table == null)
        {
            Debug.LogErrorFormat("CreateScene-Load table is error!!! {0}", battleData.matchId);

            Release();

#if !SERVER
            UISystem.Get().HideAllWindow();
            UISystem.Get().ShowWindow("LogoWindow");
#endif

            return;
        }

        CreateScene(isEditer, table, usr, isHaveRandom);
    }
Example #19
0
        public void DisConnectedCallback()
        {
                        #if SERVER
            BattleSystem.Instance.battleData.RefereeBusy   = false;
            BattleSystem.Instance.battleData.RefereeFinish = true;
                        #else
            //Tips.Make(Tips.TipsType.FlowUp, "网络已断开!", 1);
            ping.Pong(-1);
            EventSystem.Instance.FireEvent(EventId.NetworkStatus, false);

            // 如果被踢,则不重连
            if (LocalPlayer.Get().isAccountTokenOver)
            {
                return;
            }

            // 此处判断一下是否是在游戏中,如果在PVP游戏中,则重新resume
            BattleData battleData = BattleSystem.Instance.battleData;
            if (battleData.gameState == GameState.Game || battleData.gameState == GameState.GameWatch || battleData.gameState == GameState.Watcher)
            {
                if (battleData.gameType == GameType.PVP || battleData.gameType == GameType.League)
                {
                    EventSystem.Instance.FireEvent(EventId.OnBattleDisconnect);
                }
            }
            else
            {
                if (battleData.gameType == GameType.PVP || battleData.gameType == GameType.League)
                {
                    BattleSystem.Instance.Reset();

                    UISystem.Get().ShowWindow("CommonDialogWindow");
                    UISystem.Get().OnEventHandler((int)EventId.OnCommonDialog, "CommonDialogWindow",
                                                  1, LanguageDataProvider.GetValue(21), new EventDelegate(BackStartWindow));
                }
            }
                        #endif
        }
Example #20
0
    /// <summary>
    /// 报名
    /// </summary>
    public void OnSignupClick()
    {
        // 弹出提示框
        DateTime battleStart  = TimeSystem.Instance.GetTimeCST(leagueInfo.combat_start);
        DateTime battleFinish = TimeSystem.Instance.GetTimeCST(leagueInfo.combat_finish);
        string   str          = string.Empty;

        if (battleStart.Year == battleFinish.Year && battleStart.Month == battleFinish.Month && battleStart.Day == battleFinish.Day)
        {
            str = LanguageDataProvider.Format(717, battleStart.Year, battleStart.Month, battleStart.Day, battleStart.Hour, battleStart.Minute
                                              , battleFinish.Hour, battleFinish.Minute);
        }
        else
        {
            str = LanguageDataProvider.Format(718, battleStart.Year, battleStart.Month, battleStart.Day, battleStart.Hour, battleStart.Minute
                                              , battleFinish.Year, battleFinish.Month, battleFinish.Day, battleFinish.Hour, battleFinish.Minute);
        }

        UISystem.Get().ShowWindow("CommonDialogWindow");
        EventSystem.Instance.FireEvent(EventId.OnCommonDialog,
                                       2, str, new EventDelegate(() => {
            NetSystem.Instance.helper.RequestLeagueSignUp(leagueInfo.id);
        }));
    }
Example #21
0
    public override void OnUIEventHandler(EventId eventId, params object[] args)
    {
        if (eventId == EventId.OnMatchInit)
        {
            // room init
            matchId = (string)args [0];
            roomId  = (string)args [1];
            IList <NetMessage.UserData> userList = (IList <NetMessage.UserData>)args [2];
            IList <int> userIndexList            = (IList <int>)args [3];
            hostId    = (int)args [4];
            playerNum = (int)args[5];

            // format data
            int nPlayerCount = 0;
            for (int i = 0; i < userList.Count; ++i)
            {
                PlayerData pd = new PlayerData();
                if (pd.userId > 0)
                {
                    nPlayerCount++;
                }
                pd.Init(userList [i]);
                int index = userIndexList [i];
                allPlayers [index] = pd;
            }

            SetModelPage();
            SetPage();
            Flurry.Instance.FlurryPVPBattleMatchEvent("1", matchId, "0", nPlayerCount.ToString(), roomId);
        }
        else if (eventId == EventId.OnMatchUpdate)
        {
            // room update

            IList <NetMessage.UserData> userAddList = (IList <NetMessage.UserData>)args [0];
            IList <int>  userIndexAddList           = (IList <int>)args [1];
            IList <int>  userIndexDeleteList        = (IList <int>)args [2];
            IList <bool> userKickList       = (IList <bool>)args [3];
            IList <int>  userChangeFromList = (IList <int>)args [4];
            IList <int>  userChangeToList   = (IList <int>)args [5];
            if (args.Length == 7)
            {
                hostId = (int)args [6];
            }

            for (int i = 0; i < userIndexDeleteList.Count; ++i)
            {
                int index = userIndexDeleteList [i];

                if (allPlayers [index] != null && allPlayers [index].userId == LocalPlayer.Get().playerData.userId)
                {
                    // 自己退出,则关闭页面
                    UISystem.Instance.HideWindow("RoomWaitWindow");
                    UISystem.Instance.ShowWindow("CreateRoomWindow");

                    if (userKickList [i])
                    {
                        // 被踢
                        Tips.Make(Tips.TipsType.FlowUp, LanguageDataProvider.GetValue(909), 1.0f);
                    }
                }

                allPlayers [index] = null;
            }
            // add
            for (int i = 0; i < userAddList.Count; ++i)
            {
                PlayerData pd = new PlayerData();
                pd.Init(userAddList [i]);
                int index = userIndexAddList [i];
                allPlayers [index] = pd;
            }
            // change pos
            for (int i = 0; i < userChangeFromList.Count; ++i)
            {
                AudioManger.Get().PlayEffect("onOpen");
                int from = userChangeFromList [i];
                int to   = userChangeToList [i];

                PlayerData temp = allPlayers [from];
                allPlayers [from] = allPlayers [to];
                allPlayers [to]   = temp;
            }

            SetPage();
        }
        else if (eventId == EventId.OnMatchQuit)
        {
            // quit , 谁触发的quit,谁收到quit,
            NetMessage.ErrCode code = (NetMessage.ErrCode)args [0];
            if (code == NetMessage.ErrCode.EC_NotMaster)
            {
                Tips.Make(Tips.TipsType.FlowUp, LanguageDataProvider.GetValue(905), 1.0f);
            }
            else if (code != NetMessage.ErrCode.EC_Ok)
            {
                Tips.Make(Tips.TipsType.FlowUp, LanguageDataProvider.Format(901, code), 1.0f);
            }
            else if (code == NetMessage.ErrCode.EC_Ok)
            {
                UISystem.Get().HideAllWindow();
                UISystem.Get().ShowWindow("CreateRoomWindow");
            }
        }
    }
Example #22
0
 public override void OnHide()
 {
     UISystem.Get().HideWindow("FriendMembersWindow");
 }
Example #23
0
 private void ShowSelectMap(GameObject go)
 {
     selectTab.transform.SetParent(go.transform, false);
     UISystem.Get().HideAllWindow();
     UISystem.Get().ShowWindow("SelectMapWindow");
 }
Example #24
0
 public void OnSettingClick()
 {
     UISystem.Get().HideAllWindow();
     UISystem.Get().ShowWindow("SettingWindow");
 }
Example #25
0
 private void OnChampionClick(GameObject go)
 {
     selectTab.transform.SetParent(go.transform, false);
     UISystem.Get().HideAllWindow();
     UISystem.Get().ShowWindow("CustomSelectWindowNew");
 }
Example #26
0
 private void OnFightClick(GameObject go)
 {
     selectTab.transform.SetParent(go.transform, false);
     UISystem.Get().HideAllWindow();
     UISystem.Get().ShowWindow("StartWindow");
 }
Example #27
0
 private void ShowRecord(GameObject go)
 {
     selectTab.transform.SetParent(go.transform, false);
     UISystem.Get().HideAllWindow();
     UISystem.Get().ShowWindow("ReplayWindow");
 }
Example #28
0
    // 发送退出战斗指令
    public void QuitBattle(bool finish = false)
    {
#if !SERVER
        BattleSystem.Instance.StopLockStep();


        if (BattleSystem.Instance.battleData.gameType != GameType.TestLevel &&
            BattleSystem.Instance.battleData.gameType != GameType.SingleLevel)
        {
            // 单机关卡需要上报完成当前关卡
            if (battleData.currentTeam == battleData.winTEAM &&
                LocalPlayer.Get().playerData.singleFightNext)
            {
            }
            else
            {
                // 只有在创关卡的时候才设置
                if (LocalPlayer.Get().playerData.singleFightNext&& finish)
                {
                    LocalLevelStorage.Get().Levelfails = LocalLevelStorage.Get().Levelfails + 1;
                    LocalLevelStorage.Get().SetLevelInfo(battleData.matchId);
                }
            }
        }


        if (finish)
        {
            // 闪白
            Team  winTeam  = BattleSystem.Instance.sceneManager.teamManager.GetTeam(battleData.winTEAM);
            Color winColor = winTeam.color;
            BattleSystem.Instance.sceneManager.ShowWinEffect(winTeam, winColor);

            Debug.Log("win team ***************************hitships: " + winTeam.hitships + "    destroy ******************:  " + winTeam.destory);
            UISystem.Get().ShowWindow("BattleEndWindow");
            //EventSystem.Instance.FireEvent(EventId.VictionaryWinTeam, winTeam);
            EventSystem.Instance.FireEvent(EventId.OnFinished);
            EventSystem.Instance.FireEvent(EventId.OnFinishedColor, winColor, winTeam);

            if (battleData.winTEAM != battleData.currentTeam)
            {
                Team  ownTeam   = BattleSystem.Instance.sceneManager.teamManager.GetTeam(BattleSystem.Instance.battleData.currentTeam);
                int   destorys  = ownTeam.destory;
                int   hitships  = ownTeam.hitships;
                int   produce   = ownTeam.produces;
                float totalTime = BattleSystem.Instance.sceneManager.GetBattleTime();
                Flurry.Instance.FlurryBattleEndEvent(battleData.matchId, "2", "0", "0", hitships.ToString(), destorys.ToString(), totalTime.ToString());
            }
            //sdk
            ThirdPartySystem.Instance.OnFinishPve(battleData.matchId);
        }
        else
        {
            // 记录失败事件
            Team  ownTeam   = BattleSystem.Instance.sceneManager.teamManager.GetTeam(BattleSystem.Instance.battleData.currentTeam);
            int   destorys  = ownTeam.destory;
            int   hitships  = ownTeam.hitships;
            int   produce   = ownTeam.produces;
            float totalTime = BattleSystem.Instance.sceneManager.GetBattleTime();
            Flurry.Instance.FlurryBattleEndEvent(battleData.matchId, "1", "0", "0", hitships.ToString(), destorys.ToString(), totalTime.ToString());


            // 关闭窗口退出
            UISystem.Get().HideAllWindow();
            BattleSystem.Instance.BeginFadeOut();

            //ShipFadeManager.Get().SetFadeType(ShipFadeManager.FADETYPE.OUT, 0.1f);
            //UISystem.Get().FadeBattle(false, new EventDelegate(() =>
            //{
            //    if (BattleSystem.Instance.battleData.gameType == GameType.Single)
            //    {
            //        BattleSystem.Instance.Reset();
            //        UISystem.Get().ShowWindow("CustomSelectWindow");
            //    }

            //    if (BattleSystem.Instance.battleData.gameType == GameType.TestLevel)
            //    {
            //        BattleSystem.Instance.Reset();
            //        UISystem.Get().ShowWindow("CustomTestLevelWindow");
            //    }

            //    if (BattleSystem.Instance.battleData.gameType == GameType.SingleLevel)
            //    {
            //        BattleSystem.Instance.Reset();
            //        UISystem.Get().ShowWindow("LobbyWindowView");
            //    }
            //    if (BattleSystem.Instance.battleData.gameType == GameType.PayLevel)
            //    {
            //        BattleSystem.Instance.Reset();
            //        UISystem.Get().ShowWindow("ChapterWindow");
            //        EventSystem.Instance.FireEvent(EventId.OnSingleBattleEnd, 0);
            //    }
            //}));
            //sdk
            ThirdPartySystem.Instance.OnFailPve(battleData.matchId);
        }
        // 扣除5点体力
        //LocalPlayer.Get().ChangePower(-5);
#endif
    }
Example #29
0
 public void BackStartWindow()
 {
     UISystem.Get().HideAllWindow();
     UISystem.Get().ShowWindow("StartWindow");
 }
Example #30
0
 public void OnCloseClick()
 {
     UISystem.Get().HideWindow("GMWindow");
 }