Example #1
0
 public void ClickBattleButton()
 {
     SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);
     UIViewController.DeactivateUIView("ClientMainView");
     UIViewController.ActivateUIView(RoleView.Load());
     ClientGameManager.Instance.gameObject.SetActive(true);
 }
Example #2
0
 public void ClickStatsButton()
 {
     SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);
     UIViewController.DeactivateUIView("ClientMainView");
     UIViewController.ActivateUIView(BackgroundView.Load());
     UIViewController.ActivateUIView(HistoryView.Load());
 }
Example #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");
 }
Example #4
0
    public void ClickBack()
    {
        SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);

        UIViewController.DeactivateUIView("HistoryView");
        UIViewController.DeactivateUIView("BackgroundView");
        UIViewController.ActivateUIView("ClientMainView");
    }
Example #5
0
    public void ClickPrepare()
    {
        PrepareSplashImage.Deactivate();
        PrepareButton.Deactivate();
        DeactivateTimer();
        ActivateTip(0);

        UIViewController.ActivateUIView(PathView.Load());
        UIViewController.ActivateUIView(PositionView.Load());
    }
    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;
        }
    }
Example #7
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;
    }
Example #8
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");
    }
Example #9
0
    public void ClickBackButton()
    {
        if (Client)
        {
            SceneManager.LoadScene("Client");
        }
        else
        {
            UIViewController.DeactivateUIView("ResultsView");
            UIViewController.ActivateUIView("MainView");

            SetUpButtons();
        }
    }
Example #10
0
    protected override void OnActivate()
    {
        base.OnActivate();

        // test stats
        //Avatar.Instance.SetAvatarStats(5, 5, 5);

        InitStats();

        AvatarImage.sprite = AssetLookUp.Instance.GetAvatarBody(Database.Instance.GetBodyAssetForBodyType(Avatar.Instance.BodyType));
        Database.Instance.BuildCurrentFaceList();
        Database.Instance.BuildCurrentHairList();
        Database.Instance.BuildCurrentGearList();
        AvatarImage.color = Colors.HexToColor(Avatar.Instance.SkinColor);
        if (Avatar.Instance.FaceAsset != null && Avatar.Instance.FaceAsset != "")
        {
            FaceImage.sprite = AssetLookUp.Instance.GetAvatarFace(Avatar.Instance.FaceAsset);
        }
        else
        {
            FaceImage.sprite = AssetLookUp.Instance.GetAvatarFace(Database.Instance.GetCurrentFaceList()[0].ObjectId);
        }
        FaceImage.color  = Colors.HexToColor(Database.Instance.GetFaceColorForSkinColor(Avatar.Instance.SkinColor));
        HairImage.sprite = AssetLookUp.Instance.GetAvatarHair(Avatar.Instance.HairAsset);
        //Debug.Log("1 set hair sprite to " + HairImage.sprite);
        HairImage.color   = Colors.HexToColor(Avatar.Instance.HairColor);
        ShirtImage.sprite = AssetLookUp.Instance.GetAvatarClothes(Database.Instance.GetShirtAssetForBodyType(Avatar.Instance.BodyType));
        if (Avatar.Instance.Color == TeamColor.RED)
        {
            ShirtImage.color = Colors.RedShirtColor;
        }
        else
        {
            ShirtImage.color = Colors.BlueShirtColor;
        }
        ShortsImage.sprite = AssetLookUp.Instance.GetAvatarClothes(Database.Instance.GetShortsAssetForBodyType(Avatar.Instance.BodyType));

        DisplayEquippedGear();

        _state = AvatarViewState.MAIN;
        UIViewController.ActivateUIView(CoinsGemsView.Load());
        UIViewController.ActivateUIView(AmmoBeltView.Load());

        if (!PlayerPrefs.HasKey("AvatarViewTutorial") || PlayerPrefs.GetInt("AvatarViewTutorial") != 1)
        {
            ClickTutorial();
            PlayerPrefs.SetInt("AvatarViewTutorial", 1);
        }
    }
Example #11
0
    IEnumerator ReplayGame()
    {
        //Debug.Log("replaygame");

        yield return(StartCoroutine(OnlineManager.Instance.StartReplayGame()));

        PathManager.Instance.Initialize();

        SetUpGameFromData();

        LoadingAlert.FinishLoading();
        UIViewController.ActivateUIView("CountdownView");
        _replay = true;
        enabled = true;
    }
Example #12
0
    IEnumerator SignIn()
    {
        OnlineManager.Instance.SetServer();

        yield return(StartCoroutine(OnlineManager.Instance.StartLogin(_username, _password)));

        //Debug.Log(OnlineManager.Token);

        if (OnlineManager.Token != null && OnlineManager.Token != "")
        {
            yield return(StartCoroutine(OnlineManager.Instance.StartGetPlayer(OnlineManager._playerID)));

            if (OnlineManager.Instance.PlayerReponseData.player.gamemaster)
            {
                GameManager.Client = false;
                SceneManager.LoadScene("Moderator");
            }

            if (!OnlineManager.Instance.GetRequestFailure)
            {
                if (OnlineManager.Instance.PlayerID == null || OnlineManager.Instance.PlayerReponseData.status != "ok")
                {
                    LoadingAlert.FinishLoading();
                    HTTPAlert.Present("Login Error", OnlineManager.Instance.Error, null, null, true);
                }
                else
                {
                    yield return(StartCoroutine(OnlineManager.Instance.StartGetGame()));

                    yield return(StartCoroutine(OnlineManager.Instance.StartGetGear()));

                    Database.Instance.BuildAllData();
                    Database.Instance.BuildGearList();
                    PathManager.Instance.Initialize();

                    if (!Avatar.Instance.Embodied)
                    {
                        UIViewController.ActivateUIView(AvatarCreationView.Load());
                        UIViewController.ActivateUIView(AvatarStatsView.Load());
                    }

                    LoadingAlert.FinishLoading();
                    Deactivate();
                }
            }
        }
    }
Example #13
0
    public void ClickRole(int roleIndex)
    {
        SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);

        Avatar.Instance.Role = (PieceRole)roleIndex;
        if ((PieceRole)roleIndex == PieceRole.OFFENSE)
        {
            UIViewController.ActivateUIView(PathView.Load());
            State = RoleViewState.PATH;
        }
        else
        {
            UIViewController.ActivateUIView(PositionView.Load());
            State = RoleViewState.POSITION;
        }
        PrepareSplashImage.Deactivate();
    }
Example #14
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;
    }
Example #15
0
    void SetUpButtons()
    {
        if (SceneManager.GetActiveScene().name == "Moderator")
        {
            PlayButton.Disable();

            if (Client)
            {
                LoadingAlert.Present();
                PlayButton.Deactivate();
                LockButton.Deactivate();
                _countdown      = true;
                _countdownTimer = COUNTDOWN_TIME;
                StartCoroutine(ReplayGame());
            }
            else
            {
                UIViewController.ActivateUIView("MainView");
                //OnlineManager.Instance.SetServer(false, true, false);
                StartCoroutine(GetGameData());
            }
        }
    }
Example #16
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;
    }
Example #17
0
 public void ClickSettingsButton()
 {
     SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);
     UIViewController.ActivateUIView(SettingsView.Load());
 }
Example #18
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;
         * }
         */
    }
Example #19
0
 public void ClickColor(int colorIndex)
 {
     Avatar.Instance.Color = (TeamColor)colorIndex;
     UIViewController.ActivateUIView(JobView.Load());
     UIViewController.DeactivateUIView("ColorView");
 }
Example #20
0
 public void ClickBack()
 {
     UIViewController.DeactivateUIView("JobView");
     UIViewController.ActivateUIView(ColorView.Load());
 }
Example #21
0
 public void ClickJob(int jobIndex)
 {
     Avatar.Instance.Type = (PieceType)jobIndex;
     UIViewController.ActivateUIView(StatsView.Load());
     UIViewController.DeactivateUIView("JobView");
 }
Example #22
0
    IEnumerator CheckBattleStatus()
    {
        yield return(StartCoroutine(OnlineManager.Instance.StartGetGame()));

        PathManager.Instance.Initialize();

        if (OnlineManager.Instance.GameStatus == OnlineGameStatus.PREPARING)
        {
            State = RoleViewState.ROLE;
            bool selectionAlreadyMade = false;
            //Debug.Log(Avatar.Instance.Role + " " + Avatar.Instance.Path + " " + Avatar.Instance.Path.Points + " " + Avatar.Instance.Path.Points.Count);
            if (Avatar.Instance.Role == PieceRole.OFFENSE && Avatar.Instance.Path != null && Avatar.Instance.Path.Points != null && Avatar.Instance.Path.Points.Count > 1)
            {
                State = RoleViewState.PATH_SELECTED;
                selectionAlreadyMade = true;
            }
            else if (Avatar.Instance.Role == PieceRole.DEFENSE && Avatar.Instance.Path != null && Avatar.Instance.Path.Points != null && Avatar.Instance.Path.Points.Count == 1)
            {
                State = RoleViewState.POSITION_SELECTED;
                selectionAlreadyMade = true;
            }
            //Debug.Log(selectionAlreadyMade);
            if (selectionAlreadyMade)
            {
                PreparedSplashImage.Activate();
                SelectButton.ButtonIconImage.sprite = ChangePositionButtonSprite;
                SelectButton.Activate();

                UIViewController.ActivateUIView(PathView.Load());
                UIViewController.ActivateUIView(PositionView.Load());

                if (State == RoleViewState.PATH_SELECTED)
                {
                    UnselectPositions();
                    PathView.Instance.ActivateExistingPath();
                }
                else
                {
                    UnselectPaths();
                    PositionView.Instance.ActivateExistingPosition();
                }

                DisablePathAndPositionSelection();

                ActivateTimer();
                MoveTimerUp();
            }
            else
            {
                SelectButton.Deactivate();

                PrepareSplashImage.Activate();
                PrepareButton.Activate();

                ActivateTimer();
            }

            // calculate time
            _nextBattleDateTime = DateTime.Parse(OnlineManager.Instance.GameData.scheduled_start);
            //Debug.Log(_nextBattleDateTime);
            SetTimeText();
            //Debug.Log(timeToNextBattle);

            RefreshButton.Activate();
            enabled = true;
        }
        else
        {
            SelectButton.Deactivate();
            PrepareSplashImage.Deactivate();
            PreparedSplashImage.Activate();
        }
        BackButton.Activate();
    }
Example #23
0
 public void ClickBack()
 {
     UIViewController.DeactivateUIView("StatsView");
     UIViewController.ActivateUIView(JobView.Load());
 }
Example #24
0
    void ActivateResultsView()
    {
        if (OnlineManager.Instance.GameData.winner == "red")
        {
            _redTeam.Status = TeamStatus.WON;
        }
        else if (OnlineManager.Instance.GameData.winner == "blue")
        {
            _blueTeam.Status = TeamStatus.WON;
        }

        int redAttackMVP   = -1;
        int blueAttackMVP  = -1;
        int redDefenseMVP  = -1;
        int blueDefenseMVP = -1;

        if (OnlineManager.Instance.GameData.team_summaries[0].team_name == "red")
        {
            _redTeam.Downs         = OnlineManager.Instance.GameData.team_summaries[0].takedowns;
            _redTeam.FlagCaptures  = OnlineManager.Instance.GameData.team_summaries[0].pickups;
            _blueTeam.Downs        = OnlineManager.Instance.GameData.team_summaries[1].takedowns;
            _blueTeam.FlagCaptures = OnlineManager.Instance.GameData.team_summaries[1].pickups;
            if (OnlineManager.Instance.GameData.team_summaries[0].attack_mvps != null && OnlineManager.Instance.GameData.team_summaries[0].attack_mvps.Count > 0)
            {
                redAttackMVP = OnlineManager.Instance.GameData.team_summaries[0].attack_mvps[0];
            }
            if (OnlineManager.Instance.GameData.team_summaries[0].defend_mvps != null && OnlineManager.Instance.GameData.team_summaries[0].defend_mvps.Count > 0)
            {
                redDefenseMVP = OnlineManager.Instance.GameData.team_summaries[0].defend_mvps[0];
            }
            if (OnlineManager.Instance.GameData.team_summaries[1].attack_mvps != null && OnlineManager.Instance.GameData.team_summaries[1].attack_mvps.Count > 0)
            {
                blueAttackMVP = OnlineManager.Instance.GameData.team_summaries[1].attack_mvps[0];
            }
            if (OnlineManager.Instance.GameData.team_summaries[1].defend_mvps != null && OnlineManager.Instance.GameData.team_summaries[1].defend_mvps.Count > 0)
            {
                blueDefenseMVP = OnlineManager.Instance.GameData.team_summaries[1].defend_mvps[0];
            }
        }
        else
        {
            _blueTeam.Downs        = OnlineManager.Instance.GameData.team_summaries[0].takedowns;
            _blueTeam.FlagCaptures = OnlineManager.Instance.GameData.team_summaries[0].pickups;
            _redTeam.Downs         = OnlineManager.Instance.GameData.team_summaries[1].takedowns;
            _redTeam.FlagCaptures  = OnlineManager.Instance.GameData.team_summaries[1].pickups;
            if (OnlineManager.Instance.GameData.team_summaries[1].attack_mvps != null && OnlineManager.Instance.GameData.team_summaries[1].attack_mvps.Count > 0)
            {
                redAttackMVP = OnlineManager.Instance.GameData.team_summaries[1].attack_mvps[0];
            }
            if (OnlineManager.Instance.GameData.team_summaries[1].defend_mvps != null && OnlineManager.Instance.GameData.team_summaries[1].defend_mvps.Count > 0)
            {
                redDefenseMVP = OnlineManager.Instance.GameData.team_summaries[1].defend_mvps[0];
            }
            if (OnlineManager.Instance.GameData.team_summaries[0].attack_mvps != null && OnlineManager.Instance.GameData.team_summaries[0].attack_mvps.Count > 0)
            {
                blueAttackMVP = OnlineManager.Instance.GameData.team_summaries[0].attack_mvps[0];
            }
            if (OnlineManager.Instance.GameData.team_summaries[0].defend_mvps != null && OnlineManager.Instance.GameData.team_summaries[0].defend_mvps.Count > 0)
            {
                blueDefenseMVP = OnlineManager.Instance.GameData.team_summaries[0].defend_mvps[0];
            }
        }
        //Debug.Log("redAttackMVP = " + redAttackMVP + " blueAttackMVP = " + blueAttackMVP + " redDefenseMVP = " + redDefenseMVP + " blueDefenseMVP = " + blueDefenseMVP);
        // find MVP names
        Piece piece = null;
        int   i;

        // set MVPs
        for (i = 0; i < _redTeam.Pieces.Count; i++)
        {
            piece = _redTeam.Pieces[i];
            if (piece.ID == redAttackMVP)
            {
                _redTeam.AttackMVP = piece;
            }
            else if (piece.ID == redDefenseMVP)
            {
                _redTeam.DefendMVP = piece;
            }
        }
        for (i = 0; i < _blueTeam.Pieces.Count; i++)
        {
            piece = _blueTeam.Pieces[i];
            if (piece.ID == blueAttackMVP)
            {
                _blueTeam.AttackMVP = piece;
            }
            else if (piece.ID == blueDefenseMVP)
            {
                _blueTeam.DefendMVP = piece;
            }
        }

        ResultsView.Init(_redTeam, _blueTeam, _gameTime);
        UIViewController.ActivateUIView("ResultsView");
    }