コード例 #1
0
ファイル: LanguageManager.cs プロジェクト: valkidy/crushpiec
    private void Process_UpdateQuestionToGUI()
    {
        m_AttackQuestionLabel.text   = this.m_AttackQuestion.QuestionString;
        this.m_AttackInputField.text = "";
        m_DefendQuestionLabel.text   = this.m_DefendQuestion.QuestionString;

        RandomizeMapper();

        int actuallyIndexFromAnswer = 0;

        for (int i = 0; i < m_DenfendButtonText.Length && i < m_DefendRandomMapper.Length; ++i)
        {
            actuallyIndexFromAnswer = m_DefendRandomMapper[i];
            // Debug.Log("button i=" + i + " actuallyIndexFromAnswer=" + actuallyIndexFromAnswer );

            if (i < this.m_DefendQuestion.m_Answers.Count)
            {
                m_DenfendButtonText[i].text = m_DefendQuestion.m_Answers[actuallyIndexFromAnswer].AnswerString;
            }
            else
            {
                m_DenfendButtonText[i].text = "";
            }
        }

        StartActionAnimation(true);
        m_State = LanguageUIState.LanguageUIState_WaitPlayer;
    }
コード例 #2
0
ファイル: LanguageManager.cs プロジェクト: valkidy/crushpiec
 private void Process_WaitBattlePlay()
 {
     if (m_BattlePlay && false == m_BattlePlay.IsInAnimation())
     {
         m_State = LanguageUIState.LanguageUIState_StartRequestQuestion;
     }
 }
コード例 #3
0
ファイル: LanguageManager.cs プロジェクト: valkidy/crushpiec
 private void Process_StartInitialize()
 {
     if (null != m_Server)
     {
         this.m_Server.RequestQuestions();
         m_State = LanguageUIState.LanguageUIState_WaitInitialize;
     }
 }
コード例 #4
0
ファイル: LanguageManager.cs プロジェクト: valkidy/crushpiec
 private void Process_StartRequestQuestion()
 {
     if (m_Server)
     {
         m_AttackQuestion = m_Server.GetAQuestion();
         m_DefendQuestion = m_Server.GetAQuestion();
     }
     m_State = LanguageUIState.LanguageUIState_WaitRequestQuestion;
 }
コード例 #5
0
ファイル: LanguageManager.cs プロジェクト: valkidy/crushpiec
    private void Process_StartRequestAddAnswer()
    {
        if (string.Empty == this.m_AttackInputField.text)
        {
            return;
        }

        if (m_Server)
        {
            m_Server.RequestAddAnswer(m_AttackQuestion.ID, this.m_AttackInputField.text);
        }
        m_State = LanguageUIState.LanguageUIState_WaitRequestAddAnswer;
    }
コード例 #6
0
ファイル: LanguageManager.cs プロジェクト: valkidy/crushpiec
    private void TryDoDefend(int _Index)
    {
        int actuallyIndexFromAnswer = m_DefendRandomMapper[_Index];

        Debug.Log("_Index=" + _Index + " actuallyIndexFromAnswer=" + actuallyIndexFromAnswer);
        if (m_State != LanguageUIState.LanguageUIState_WaitPlayer)
        {
            return;
        }
        if (m_BattlePlay)
        {
            float ratio = m_DefendQuestion.CalculateRatioOfIndex(actuallyIndexFromAnswer);
            m_BattlePlay.Defend(ratio * 2);
        }
        StartActionAnimation(false);
        m_State = LanguageUIState.LanguageUIState_WaitBattlePlay;
    }
コード例 #7
0
ファイル: LanguageManager.cs プロジェクト: valkidy/crushpiec
    // Update is called once per frame
    void Update()
    {
        switch (m_State)
        {
        case LanguageUIState.LanguageUIState_Invalid:
            m_State = LanguageUIState.LanguageUIState_StartInitialize;
            break;

        case LanguageUIState.LanguageUIState_StartInitialize:
            Process_StartInitialize();
            break;

        case LanguageUIState.LanguageUIState_WaitInitialize:
            Process_WaitInitialize();
            break;

        case LanguageUIState.LanguageUIState_StartRequestQuestion:
            Process_StartRequestQuestion();
            break;

        case LanguageUIState.LanguageUIState_WaitRequestQuestion:
            Process_WaitRequestQuestion();
            break;

        case LanguageUIState.LanguageUIState_UpdateQuestionToGUI:
            Process_UpdateQuestionToGUI();
            break;

        case LanguageUIState.LanguageUIState_WaitPlayer:
            break;

        case LanguageUIState.LanguageUIState_WaitBattlePlay:
            Process_WaitBattlePlay();
            break;

        case LanguageUIState.LanguageUIState_StartRequestAddAnswer:
            Process_StartRequestAddAnswer();
            break;

        case LanguageUIState.LanguageUIState_WaitRequestAddAnswer:
            Process_WaitRequestAddAnswer();
            break;
        }
    }
コード例 #8
0
ファイル: LanguageManager.cs プロジェクト: valkidy/crushpiec
    public void TryDoAttack()
    {
        Debug.Log("TryDoAttack");
        if (m_State != LanguageUIState.LanguageUIState_WaitPlayer)
        {
            return;
        }

        if (null != m_AttackInputField && string.Empty != m_AttackInputField.text)
        {
            string stringFromInput = m_AttackInputField.text;
            Debug.Log("stringFromInput=" + stringFromInput);
            if (m_BattlePlay)
            {
                float ratio = m_AttackQuestion.TryCalculateRatioOfAnAnswer(stringFromInput);
                m_BattlePlay.Attack(ratio * 2);
            }
            StartActionAnimation(false);
            m_State = LanguageUIState.LanguageUIState_StartRequestAddAnswer;
        }
    }
コード例 #9
0
ファイル: LanguageManager.cs プロジェクト: NDark/crushpiec
    public void TryDoAttack()
    {
        Debug.Log("TryDoAttack");
        if (m_State != LanguageUIState.LanguageUIState_WaitPlayer )
        {
            return ;
        }

        if( null != m_AttackInputField && string.Empty != m_AttackInputField.text )
        {
            string stringFromInput = m_AttackInputField.text ;
            Debug.Log("stringFromInput=" + stringFromInput );
            if( m_BattlePlay )
            {
                float ratio = m_AttackQuestion.TryCalculateRatioOfAnAnswer( stringFromInput ) ;
                m_BattlePlay.Attack( ratio * 2 ) ;
            }
            StartActionAnimation( false ) ;
            m_State = LanguageUIState.LanguageUIState_StartRequestAddAnswer ;
        }
    }
コード例 #10
0
ファイル: LanguageManager.cs プロジェクト: NDark/crushpiec
 private void Process_StartRequestQuestion()
 {
     if( m_Server )
     {
         m_AttackQuestion = m_Server.GetAQuestion() ;
         m_DefendQuestion = m_Server.GetAQuestion() ;
     }
     m_State = LanguageUIState.LanguageUIState_WaitRequestQuestion ;
 }
コード例 #11
0
ファイル: LanguageManager.cs プロジェクト: valkidy/crushpiec
 private void Process_WaitRequestAddAnswer()
 {
     m_State = LanguageUIState.LanguageUIState_WaitBattlePlay;
 }
コード例 #12
0
ファイル: LanguageManager.cs プロジェクト: NDark/crushpiec
 private void Process_WaitBattlePlay()
 {
     if( m_BattlePlay && false == m_BattlePlay.IsInAnimation() )
     {
         m_State = LanguageUIState.LanguageUIState_StartRequestQuestion ;
     }
 }
コード例 #13
0
ファイル: LanguageManager.cs プロジェクト: NDark/crushpiec
 private void Process_WaitInitialize()
 {
     m_State = LanguageUIState.LanguageUIState_StartRequestQuestion ;
 }
コード例 #14
0
ファイル: LanguageManager.cs プロジェクト: NDark/crushpiec
 private void Process_WaitRequestAddAnswer()
 {
     m_State = LanguageUIState.LanguageUIState_WaitBattlePlay ;
 }
コード例 #15
0
ファイル: LanguageManager.cs プロジェクト: valkidy/crushpiec
 private void Process_WaitRequestQuestion()
 {
     m_State = LanguageUIState.LanguageUIState_UpdateQuestionToGUI;
 }
コード例 #16
0
ファイル: LanguageManager.cs プロジェクト: NDark/crushpiec
 private void Process_WaitRequestQuestion()
 {
     m_State = LanguageUIState.LanguageUIState_UpdateQuestionToGUI ;
 }
コード例 #17
0
ファイル: LanguageManager.cs プロジェクト: valkidy/crushpiec
 private void Process_WaitInitialize()
 {
     m_State = LanguageUIState.LanguageUIState_StartRequestQuestion;
 }
コード例 #18
0
ファイル: LanguageManager.cs プロジェクト: NDark/crushpiec
 private void TryDoDefend( int _Index )
 {
     int actuallyIndexFromAnswer = m_DefendRandomMapper[ _Index ] ;
     Debug.Log("_Index=" + _Index + " actuallyIndexFromAnswer=" +actuallyIndexFromAnswer);
     if (m_State != LanguageUIState.LanguageUIState_WaitPlayer )
     {
         return ;
     }
     if( m_BattlePlay )
     {
         float ratio = m_DefendQuestion.CalculateRatioOfIndex( actuallyIndexFromAnswer ) ;
         m_BattlePlay.Defend( ratio  * 2 ) ;
     }
     StartActionAnimation( false ) ;
     m_State = LanguageUIState.LanguageUIState_WaitBattlePlay ;
 }
コード例 #19
0
ファイル: LanguageManager.cs プロジェクト: NDark/crushpiec
    private void Process_UpdateQuestionToGUI()
    {
        m_AttackQuestionLabel.text = this.m_AttackQuestion.QuestionString ;
        this.m_AttackInputField.text = "" ;
        m_DefendQuestionLabel.text = this.m_DefendQuestion.QuestionString ;

        RandomizeMapper() ;

        int actuallyIndexFromAnswer = 0 ;
        for( int i = 0 ;  i < m_DenfendButtonText.Length && i < m_DefendRandomMapper.Length ; ++i )
        {

            actuallyIndexFromAnswer = m_DefendRandomMapper[ i ] ;
            // Debug.Log("button i=" + i + " actuallyIndexFromAnswer=" + actuallyIndexFromAnswer );

            if( i < this.m_DefendQuestion.m_Answers.Count )
            {
                m_DenfendButtonText[ i ].text = m_DefendQuestion.m_Answers[ actuallyIndexFromAnswer ].AnswerString ;
            }
            else
            {
                m_DenfendButtonText[i].text = "" ;
            }
        }

        StartActionAnimation( true ) ;
        m_State = LanguageUIState.LanguageUIState_WaitPlayer ;
    }
コード例 #20
0
ファイル: LanguageManager.cs プロジェクト: NDark/crushpiec
    private void Process_StartRequestAddAnswer()
    {
        if( string.Empty == this.m_AttackInputField.text )
        {
            return ;
        }

        if( m_Server )
        {
            m_Server.RequestAddAnswer( m_AttackQuestion.ID , this.m_AttackInputField.text ) ;

        }
        m_State = LanguageUIState.LanguageUIState_WaitRequestAddAnswer ;
    }
コード例 #21
0
ファイル: LanguageManager.cs プロジェクト: NDark/crushpiec
 private void Process_StartInitialize()
 {
     if( null != m_Server )
     {
         this.m_Server.RequestQuestions() ;
         m_State = LanguageUIState.LanguageUIState_WaitInitialize ;
     }
 }
コード例 #22
0
ファイル: LanguageManager.cs プロジェクト: NDark/crushpiec
    // Update is called once per frame
    void Update()
    {
        switch( m_State )
        {
        case LanguageUIState.LanguageUIState_Invalid :
            m_State = LanguageUIState.LanguageUIState_StartInitialize ;
            break ;
        case LanguageUIState.LanguageUIState_StartInitialize :
            Process_StartInitialize() ;
            break ;
        case LanguageUIState.LanguageUIState_WaitInitialize :
            Process_WaitInitialize() ;
            break ;

        case LanguageUIState.LanguageUIState_StartRequestQuestion :
            Process_StartRequestQuestion() ;
            break ;
        case LanguageUIState.LanguageUIState_WaitRequestQuestion :
            Process_WaitRequestQuestion() ;
            break ;

        case LanguageUIState.LanguageUIState_UpdateQuestionToGUI :
            Process_UpdateQuestionToGUI() ;
            break ;
        case LanguageUIState.LanguageUIState_WaitPlayer :
            break ;
        case LanguageUIState.LanguageUIState_WaitBattlePlay :
            Process_WaitBattlePlay() ;
            break ;

        case LanguageUIState.LanguageUIState_StartRequestAddAnswer :
            Process_StartRequestAddAnswer() ;
            break ;
        case LanguageUIState.LanguageUIState_WaitRequestAddAnswer :
            Process_WaitRequestAddAnswer() ;
            break ;

        }
    }