Esempio n. 1
0
    void SelectYes()
    {
        //Debug.Log(State);

        if (State == RoleViewState.PATH)
        {
            if (PathView.Instance != null)
            {
                PathView.Instance.SelectPath();
            }
            State = RoleViewState.PATH_SELECTED;
            Avatar.Instance.Role = PieceRole.OFFENSE;
        }
        else
        {
            if (PositionView.Instance != null)
            {
                PositionView.Instance.SelectPosition();
            }
            State = RoleViewState.POSITION_SELECTED;
            Avatar.Instance.Role = PieceRole.DEFENSE;
        }

        PreparedSplashImage.Activate();

        DisablePathAndPositionSelection();

        StartCoroutine(PostInfo());
    }
Esempio n. 2
0
    public void ClickSelect()
    {
        //Debug.Log("ClickSelect");

        SoundManager.Instance.PlaySoundEffect(SoundType.BUTTON_CLICK);

        switch (State)
        {
        case RoleViewState.PATH:
        case RoleViewState.POSITION:
            if (State == RoleViewState.PATH)
            {
                if (PathView.Instance != null)
                {
                    PathView.Instance.SelectPath();
                }
                State = RoleViewState.PATH_SELECTED;
                Avatar.Instance.Role = PieceRole.OFFENSE;
            }
            else
            {
                if (PositionView.Instance != null)
                {
                    PositionView.Instance.SelectPosition();
                }
                State = RoleViewState.POSITION_SELECTED;
                Avatar.Instance.Role = PieceRole.DEFENSE;
            }

            PreparedSplashImage.Activate();
            DisablePathAndPositionSelection();
            DeactivateTip();
            ActivateTimer();
            MoveTimerUp();
            SelectButton.ButtonIconImage.sprite = ChangePositionButtonSprite;
            StartCoroutine(PostInfo());
            break;

        case RoleViewState.PATH_SELECTED:
        case RoleViewState.POSITION_SELECTED:
            PreparedSplashImage.Deactivate();
            PreparedSplashImage.Deactivate();
            PathItem.CanClick     = true;
            PositionItem.CanClick = true;
            State = RoleViewState.ROLE;
            ActivateTip(0);
            SelectButton.Deactivate();
            DeactivateTimer();
            break;
        }
    }
Esempio n. 3
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();
    }
Esempio n. 4
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();
    }