Пример #1
0
 public void ClickStatsButton()
 {
     SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);
     UIViewController.DeactivateUIView("ClientMainView");
     UIViewController.ActivateUIView(BackgroundView.Load());
     UIViewController.ActivateUIView(HistoryView.Load());
 }
Пример #2
0
 public void ClickBattleButton()
 {
     SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);
     UIViewController.DeactivateUIView("ClientMainView");
     UIViewController.ActivateUIView(RoleView.Load());
     ClientGameManager.Instance.gameObject.SetActive(true);
 }
Пример #3
0
 public void ClickNextButton()
 {
     Avatar.Instance.SetAvatarStats(_health, _speed, _range);
     UIViewController.ActivateUIView(RoleView.Load());
     ClientGameManager.Instance.gameObject.SetActive(true);
     UIViewController.DeactivateUIView("BackgroundView");
     UIViewController.DeactivateUIView("StatsView");
 }
Пример #4
0
    public void ClickBack()
    {
        SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);

        UIViewController.DeactivateUIView("HistoryView");
        UIViewController.DeactivateUIView("BackgroundView");
        UIViewController.ActivateUIView("ClientMainView");
    }
Пример #5
0
    void SetUpGameFromData()
    {
        UIViewController.DeactivateUIView("MainView");
        UIViewController.DeactivateUIView("ResultsView");

        if (!_bgAssets)
        {
            _bgAssets = true;
            for (int i = 0; i < BGSprites.Count; i++)
            {
                BGSprites[i].enabled = true;
            }
        }

        ClearAllObjects();
        if (_redTeam != null)
        {
            _redTeam.Reset();
        }
        if (_blueTeam != null)
        {
            _blueTeam.Reset();
        }

        CreateFlags();

        // create teams
        List <Piece> redPieces = new List <Piece>();

        _redTeam = new Team(TeamColor.RED, null, _redFlag.Position);
        List <Piece> bluePieces = new List <Piece>();

        _blueTeam = new Team(TeamColor.BLUE, null, _blueFlag.Position);
        List <Piece> currentPieceList;
        Team         team;

        for (int i = 0; i < OnlineManager.Instance.GameData.pieces.Count; i++)
        {
            PieceData pieceData = OnlineManager.Instance.GameData.pieces[i];
            if (pieceData.team_name == "red")
            {
                team             = _redTeam;
                currentPieceList = redPieces;
            }
            else
            {
                team             = _blueTeam;
                currentPieceList = bluePieces;
            }
            CreatePiece(currentPieceList, pieceData);
        }

        _redTeam.Pieces = redPieces;
        _redTeam.SetPieceLookups();
        _blueTeam.Pieces = bluePieces;
        _blueTeam.SetPieceLookups();
        _startTime = DateTime.UtcNow;
    }
Пример #6
0
    IEnumerator PostInfo()
    {
        yield return(StartCoroutine(OnlineManager.Instance.StartPutPlayer()));

        yield return(StartCoroutine(OnlineManager.Instance.StartPieceInfoPostCoroutine(true)));

        UIViewController.DeactivateUIView("AvatarCreationView");
        UIViewController.DeactivateUIView("AvatarChoiceView");
    }
Пример #7
0
    public void ClickNextButton()
    {
        SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);

        if (_state == AvatarCreationViewState.STATS)
        {
            UIViewController.DeactivateUIView("AvatarStatsView");
            UIViewController.ActivateUIView(AvatarChoiceView.Load());
            NextButton.Deactivate();
            _state = AvatarCreationViewState.GEAR;
        }
    }
Пример #8
0
    public void ClickStoreButton()
    {
        SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);
        UIViewController.DeactivateUIView("ClientMainView");
        UIViewController.ActivateUIView(BackgroundView.Load());
        UIViewController.ActivateUIView(GearEquipView.Load());
        AvatarView avatarView = AvatarView.Load();

        UIViewController.ActivateUIView(avatarView);
        StoreRefreshButtonObj.SetActive(true);
        StoreRefreshButtonObj.transform.SetAsLastSibling();
        avatarView.StoreRefreshButtonObj = StoreRefreshButtonObj;
    }
Пример #9
0
    public void ClickBackButton()
    {
        SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);

        UIViewController.DeactivateUIView("AvatarView");
        UIViewController.DeactivateUIView("GearEquipView");
        UIViewController.DeactivateUIView("AmmoEquipView");
        UIViewController.DeactivateUIView("StoreView");
        UIViewController.DeactivateUIView("AmmoBeltView");
        UIViewController.DeactivateUIView("CoinsGemsView");
        UIViewController.DeactivateUIView("BackgroundView");
        UIViewController.ActivateUIView("ClientMainView");
    }
Пример #10
0
    public void ClickBackButton()
    {
        if (Client)
        {
            SceneManager.LoadScene("Client");
        }
        else
        {
            UIViewController.DeactivateUIView("ResultsView");
            UIViewController.ActivateUIView("MainView");

            SetUpButtons();
        }
    }
Пример #11
0
    public void ClickShop()
    {
        SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);

        AvatarView.Instance.State = AvatarViewState.STORE;
        UIViewController.ActivateUIView(StoreView.Load());
        UIViewController.DeactivateUIView("GearEquipView");
        UIViewController.DeactivateUIView("AmmoEquipView");
        UIViewController.DeactivateUIView("AmmoBeltView");
        NavButtons[0].Disable();
        NavButtons[0].transform.localScale = new Vector3(1.2f, 1.2f, 1.2f);
        NavButtons[1].Enable();
        NavButtons[1].transform.localScale = Vector3.one;
        CoinsGemsView.Instance.MoveToFront();
        StoreRefreshButtonObj.transform.SetAsLastSibling();

        _state = AvatarViewState.STORE;
    }
Пример #12
0
    public void ClickAmmoEquip()
    {
        SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);

        AvatarView.Instance.State = AvatarViewState.AMMO;
        UIViewController.ActivateUIView(AmmoEquipView.Load());
        UIViewController.ActivateUIView(AmmoBeltView.Load());
        UIViewController.DeactivateUIView("GearEquipView");
        UIViewController.DeactivateUIView("StoreView");
        NavButtons[0].Enable();
        NavButtons[0].transform.localScale = Vector3.one;
        NavButtons[1].Disable();
        NavButtons[1].transform.localScale = new Vector3(1.2f, 1.2f, 1.2f);
        CoinsGemsView.Instance.MoveToFront();
        StoreRefreshButtonObj.transform.SetAsLastSibling();

        if (_displayedItem != null)
        {
            RemoveGear(_displayedItem);
        }

        _state = AvatarViewState.AMMO;
    }
Пример #13
0
 public void ClickBack()
 {
     UIViewController.DeactivateUIView("StatsView");
     UIViewController.ActivateUIView(JobView.Load());
 }
Пример #14
0
    void FixedUpdate()
    {
        if (_mouseOverInfo != null && _mouseOverPiece != null)
        {
            _mouseOverInfo.SetPosition(_mouseOverPiece.transform.position);
        }

        if (_replay)
        {
            if (_gameOver)
            {
                _gameOverTimer += Time.deltaTime;
                if (_gameOverTimer >= GAME_OVER_TIME)
                {
                    enabled = false;
                    LoadingAlert.Present();
                    PlayerPrefs.SetString("LAST_GAME_VIEWED", OnlineManager.Instance.GameData.id);
                    //Debug.Log("saved game id " + OnlineManager.Instance.GameData.id);
                    PlayerPrefs.Save();
                    ActivateResultsView();
                }
            }
            else
            {
                if (_countdown)
                {
                    _countdownTimer -= Time.deltaTime;
                    if (_countdownTimer < 0.0f)
                    {
                        UIViewController.DeactivateUIView("CountdownView");
                        _countdown = false;
                        //Debug.Log("here!");
                    }
                    else
                    {
                        int count = (int)Mathf.Ceil(_countdownTimer);
                        CountdownText.Text = count.ToString();
                    }
                }
                else
                {
                    if (_replayWatcherInfo != null)
                    {
                        _replayWatcherInfo.SetPosition(_replayWatcherPiece.transform.position);
                        //SetWatcherInfoPosition();
                    }

                    TurnData turnData = DataRecorder.Instance.TurnDataList[_replayIndex];
                    ReplayTurn(turnData);
                    _replayIndex++;

                    // game over
                    if (_gameOver)
                    {
                        _gameOverTimer += Time.deltaTime;
                        if (_gameOverTimer >= GAME_OVER_TIME)
                        {
                            if (_mouseOverInfo != null)
                            {
                                Destroy(_mouseOverInfo.gameObject);
                            }
                            enabled = false;
                            LoadingAlert.Present();
                            PlayerPrefs.SetString("LAST_GAME_VIEWED", OnlineManager.Instance.GameData.id);
                            //Debug.Log("saved game id " + OnlineManager.Instance.GameData.id);
                            PlayerPrefs.Save();
                            ActivateResultsView();
                        }
                    }
                    else if (_replayIndex >= DataRecorder.Instance.TurnDataList.Count)
                    {
                        if (_replayWatcherInfo != null)
                        {
                            Destroy(_replayWatcherInfo.gameObject);
                        }
                        if (_mouseOverInfo != null)
                        {
                            Destroy(_mouseOverInfo.gameObject);
                        }
                        _redTeam.StopPieceAnimations();
                        _blueTeam.StopPieceAnimations();
                        _gameOver      = true;
                        _gameOverTimer = 0.0f;
                    }
                }
            }
        }
        else
        {
            if (_gameOver)
            {
                _gameOverTimer += Time.deltaTime;
                if (_gameOverTimer >= GAME_OVER_TIME)
                {
                    enabled = false;
                    LoadingAlert.Present();
                    _gameTime = DateTime.UtcNow - _startTime;
                    _redTeam.CalulateMVPs();
                    _blueTeam.CalulateMVPs();
                    DisplayGameResults();
                }
            }
            else
            {
#if SLOW_MOTION
                if (Input.GetKey(KeyCode.A))
#endif
                {
                    StartTurn(Time.deltaTime);
                    Attack(Time.deltaTime);
                    RecordMoves();
                    RemoveDoneBalloons();
                    if (CheckGameOver())
                    {
                        _redTeam.StopPieceAnimations();
                        _blueTeam.StopPieceAnimations();
                        SoundManager.Instance.PlaySoundEffect(SoundType.CHEER);
                        _gameOver      = true;
                        _gameOverTimer = 0.0f;
                    }
                }
            }
        }
    }
Пример #15
0
    public void ClickBack()
    {
        SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);

        if (PositionView.Instance != null)
        {
            PositionView.Instance.RemovePositions();
        }
        if (PathView.Instance != null)
        {
            PathView.Instance.RemovePaths();
        }
        UIViewController.DeactivateUIView(ATTACK_SETUP_VIEW);
        UIViewController.DeactivateUIView(DEFENSE_SETUP_VIEW);
        UIViewController.DeactivateUIView(ROLE_VIEW);
        ClientGameManager.Instance.gameObject.SetActive(false);
        UIViewController.ActivateUIView("ClientMainView");

        /*
         * switch (State)
         * {
         *  case RoleViewState.ROLE:
         *      if (PositionView.Instance != null)
         *          PositionView.Instance.RemovePositions();
         *      if (PathView.Instance != null)
         *          PathView.Instance.RemovePaths();
         *                      UIViewController.DeactivateUIView(ATTACK_SETUP_VIEW);
         *                      UIViewController.DeactivateUIView(DEFENSE_SETUP_VIEW);
         *                      UIViewController.DeactivateUIView(ROLE_VIEW);
         *      ClientGameManager.Instance.gameObject.SetActive(false);
         *      UIViewController.ActivateUIView("ClientMainView");
         *      break;
         *  case RoleViewState.PATH:
         *      if (PathView.Instance != null)
         *          PathView.Instance.RemovePaths();
         *                      UIViewController.DeactivateUIView(ATTACK_SETUP_VIEW);
         *      PrepareSplashImage.Activate();
         *      State = RoleViewState.ROLE;
         *      SelectButton.Deactivate();
         *      break;
         *  case RoleViewState.POSITION:
         *      if (PositionView.Instance != null)
         *          PositionView.Instance.RemovePositions();
         *                      UIViewController.DeactivateUIView(DEFENSE_SETUP_VIEW);
         *      PrepareSplashImage.Activate();
         *      State = RoleViewState.ROLE;
         *      SelectButton.Deactivate();
         *      break;
         *  case RoleViewState.PATH_SELECTED:
         *  case RoleViewState.POSITION_SELECTED:
         *      if (PositionView.Instance != null)
         *          PositionView.Instance.RemovePositions();
         *      if (PathView.Instance != null)
         *          PathView.Instance.RemovePaths();
         *                      UIViewController.DeactivateUIView(ATTACK_SETUP_VIEW);
         *                      UIViewController.DeactivateUIView(DEFENSE_SETUP_VIEW);
         *                      UIViewController.DeactivateUIView(ROLE_VIEW);
         *      ClientGameManager.Instance.gameObject.SetActive(false);
         *      UIViewController.ActivateUIView("ClientMainView");
         *      break;
         * }
         */
    }
Пример #16
0
 public void ClickJob(int jobIndex)
 {
     Avatar.Instance.Type = (PieceType)jobIndex;
     UIViewController.ActivateUIView(StatsView.Load());
     UIViewController.DeactivateUIView("JobView");
 }
Пример #17
0
 public void ClickColor(int colorIndex)
 {
     Avatar.Instance.Color = (TeamColor)colorIndex;
     UIViewController.ActivateUIView(JobView.Load());
     UIViewController.DeactivateUIView("ColorView");
 }
Пример #18
0
    public void ClickBackButton()
    {
        SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);

        UIViewController.DeactivateUIView("SettingsView");
    }
Пример #19
0
 public void ClickBack()
 {
     UIViewController.DeactivateUIView("JobView");
     UIViewController.ActivateUIView(ColorView.Load());
 }