示例#1
0
    public override void Update()
    {
        if (Ag.NetExcpt.ConnectLossSignalGone)
        {
            ShowNetworkPopup(false);
            return;
        }

        if (NullCheck() && (mStateArr.GetCurStateName() != "ShowEndingResult" && mStateArr.GetCurStateName() != "EndingCeremony"))
        {
            ShowNetworkPopup(enemyOutCase: true);
            return;
        }

        if (!Ag.NodeObj.ReMatchRefuseSent.UI && Ag.NodeObj.ReMatchRefuseSent.Enem)
        {
            EnemyRefusedRematching();
            Ag.NodeObj.ReMatchRefuseSent.UI = true;
        }

        if (mStateArr.GetCurStateName() == "ShowEndingResult" && !AgStt.mgGameTutorial)
        {
            Ag.mySelf.ContWinCoolTimeRemain(out Contmm, out Contss);
            dicGameSceneMenuList ["victory_info"].transform.FindChild("Label_victorytime").gameObject.GetComponent <UILabel> ().text       = Contmm.ToFixedWidth(2) + ":" + Contss.ToFixedWidth(2);
            dicGameSceneMenuList ["victory_info"].transform.FindChild("Progress_victory/Foreground").GetComponent <UISprite> ().fillAmount = Ag.mySelf.ContWinCoolTimeRemainPercent() / 100;
        }


        /*
         * if (Input.GetKeyDown (KeyCode.Escape)) {
         *  if (mExitflag)
         *      GotoHome ();
         *  if (!mExitflag)
         *      mExitflag = true;
         * }
         */
        //---------------------------------------KeeperScout cooltime
        // fill Scout Amount
        int mm, ss;

        Ag.mySelf.ScoutCoolTimeRemain(out mm, out ss);
        if (!Ag.mySelf.CanIScoutNow && (Ag.mySelf.CollTimeScoutPercent() / 100) < 1)
        {
            dicGameSceneMenuList ["Kickerinfo_progress_scouter"].transform.FindChild("Foreground").gameObject.GetComponent <UISprite> ().fillAmount = Ag.mySelf.CollTimeScoutPercent() / 100;
            dicGameSceneMenuList ["Kickerinfo_progress_scouter"].transform.FindChild("Label_time").gameObject.GetComponent <UILabel> ().text        = mm.ToFixedWidth(2) + ":" + ss.ToFixedWidth(2);
            dicGameSceneMenuList ["Kickerinfo_progress_scouter"].transform.FindChild("Label_time").transform.gameObject.SetActive(true);
            dicGameSceneMenuList ["Kickerinfo_progress_scouter"].transform.FindChild("Label_cash").transform.gameObject.SetActive(true);
            dicGameSceneMenuList ["Kickerinfo_progress_scouter"].transform.FindChild("cash").transform.gameObject.SetActive(true);
        }
        if (Ag.mySelf.CanIScoutNow || Ag.mySelf.CollTimeScoutPercent() < 1)
        {
            dicGameSceneMenuList ["Kickerinfo_progress_scouter"].transform.FindChild("Label_time").transform.gameObject.SetActive(false);
            //dicGameSceneMenuList ["Kickerinfo_progress_scouter"].transform.FindChild ("Label_time").gameObject.GetComponent<UILabel> ().text = "0" + ":" + "00";
            dicGameSceneMenuList ["Kickerinfo_progress_scouter"].transform.FindChild("Label_cash").transform.gameObject.SetActive(false);
            dicGameSceneMenuList ["Kickerinfo_progress_scouter"].transform.FindChild("cash").transform.gameObject.SetActive(false);
        }

        //Debug.Log ("Ag.mySelf.CollTimeScoutPercent()" + Ag.mySelf.CollTimeScoutPercent()/100);

        base.Update();
        mStateArr.DoAction();
        stt = mStateArr.GetCurStateName();
        //Debug.Log ("Ag.mySelf.CollTimeScoutPercent()" + Ag.mySelf.CollTimeScoutPercent()/100);



        if (mGameScoreeff)
        {
            GameScoreEff();
        }

        if (mGameOver && mEnemyLeftFlag)
        {
            mRscrcMan.FindChild(mResultPanel, "Panel_btn/btn_rematch", false);
            dicGameSceneMenuList ["btn_Label"].SetActive(true);
            // 상대가 이미 퇴장함
            mRscrcMan.FindChild(dicGameSceneMenuList ["btn_Label"], "Label", true).gameObject.GetComponent <UILabel> ().text =
                WWW.UnEscapeURL("%EC%83%81%EB%8C%80%EA%B0%80%20%EC%9D%B4%EB%AF%B8%20%ED%87%B4%EC%9E%A5%ED%95%A8");
            mEnemyLeftFlag = false;
        }

        if (!mGameOver && mEnemyLeftFlag)
        {
            dicGameSceneMenuList.SetActiveAll(true, new string[] {
                "popup",
                "alert_someoneout"
            });
            mRscrcMan.FindChild(mResultPanel, "Panel_btn/btn_rematch", false);
            Ag.mgDidWin   = true;
            mNetworkError = true;
            mRscrcMan.FindChild(dicGameSceneMenuList ["btn_Label"], "Label", true).gameObject.GetComponent <UILabel> ().text =
                WWW.UnEscapeURL("%EC%83%81%EB%8C%80%EA%B0%80%20%EC%9D%B4%EB%AF%B8%20%ED%87%B4%EC%9E%A5%ED%95%A8");
            mEnemyLeftFlag = false;
        }

        if (Ag.NetExcpt.WasLoginDuplicate)
        {
            DoubleLoginError();
        }

        if (Ag.NodeObj.RematchBoth)
        {
            //하트부족시에는 팝업

            Ag.mGreenItemFlag = false;
            Ag.mRedItemFlag   = false;
            Ag.mBlueItemFlag  = false;
            RematchWasGameStart();
            Ag.NodeObj.ReMatchSent.InitSet(false);
            Ag.NodeObj.PrepareGame();

            Application.LoadLevel("GameScene");
        }

        if (Ag.NodeObj.ReMatchSent.Enem && EnemUserCheck)
        {
            EnemySentRematchAndWait();
            StartCoroutine(RematchNoAccept(8));
            EnemUserCheck = false;
        }

        if (mStateArr.GetCurStateName() == "ShowEndingResult" && mResultShow)
        {
            ResultShow();
        }
        if (mDirLightFlag)
        {
            if (mDirLight.GetComponent <Light> ().intensity < 0.8)
            {
                mDirLight.GetComponent <Light> ().intensity += 0.005f;
            }
        }
        string curStt = mStateArr.GetCurStateName();


        GoalKeeperCer();
        RedbullNum();

        if (mStateCere != null)
        {
            mStateCere.DoAction();
        }
        if (Ag.IsSmartDevice())
        {
            if (!Ag.mgIsKick && mStage.WillInputDrag())
            {
                foreach (Touch touch in Input.touches)
                {
                    if (!mDidDragStarted)
                    {
                        mVecInit        = touch.position;
                        mDidDragStarted = true;
                    }
                    else
                    {
                        mVecFin = touch.position;
                    }
                    if (touch.phase == TouchPhase.Ended)
                    {
                        if (AgStt.mgGameTutorial && !Ag.mgIsKick)
                        {
                            if ((Ag.mRound == 1 && mKeeperDragFlag) || (Ag.mRound == 2 && mKeeperDragFlag))
                            {
                                DirectionDrag();
                            }
                        }
                        else
                        {
                            DirectionDrag();
                        }
                        SetPlayerDir2();
                        mStartDrag = true;
                    }
                }
            }
            //------------------------------------------
            if (Input.GetMouseButtonDown(0))      // Skill Input
            {
                if (mStage.TouchProcess() && mStage.mIsTouchEnable)
                {
                    mStage.mCursorPosition = mStage.mCursorPosition > 999 ? 999 : mStage.mCursorPosition;

                    if (curStt == "GameDir")
                    {
                        if (AgStt.mgGameTutorial)
                        {
                            mStage.mCursorPosition = mStage.mCursorPosition > 998 ? 998 : mStage.mCursorPosition;
                        }
                        Ag.NodeObj.Direction = Ag.mgDirection = myCard.GetPosition(mStage.mCursorPosition);
                    }

//                    if (curStt == "GameSkl") {
//                        Ag.NodeObj.Skill = Ag.mgSkill = myCard.GetPosition (mStage.mCursorPosition);
//                        if (myCard.WAS.grade == "S") {
//                            Ag.NodeObj.Skill += 1;
//                            Ag.mgSkill += 1;
//                            if (!Ag.mgIsKick && Ag.mgSkill == 3)
//                                Ag.NodeObj.Skill = Ag.mgSkill = 2;
//                        }
//                        Ag.LogString ("  Touched >>>>>    Card : " + myCard.WAS.grade + "     Ag.mgSkill >" + Ag.mgSkill + "       Ag.NodeObj.Skill : " + Ag.NodeObj.Skill);
//                    }
//
                    if (curStt == "GameSkl")
                    {
                        Ag.NodeObj.Skill = Ag.mgSkill = myCard.GetPosition(mStage.mCursorPosition);

                        if (myCard.WAS.grade == "S")
                        {
                            Ag.NodeObj.Skill = Ag.mgSkill += 1;
                        }
                        if (!Ag.mgIsKick && Ag.mgSkill == 3)
                        {
                            Ag.LogIntenseWord("     (!Ag.mgIsKick && Ag.mgSkill == 3)   Case ::  Set Skill to ... 2 ");
                            Ag.NodeObj.Skill = Ag.mgSkill = 2;
                        }

                        Ag.LogString("  Touched >>>>>    Card : " + myCard.WAS.grade + "     Ag.mgSkill >" + Ag.mgSkill + "       Ag.NodeObj.Skill : " + Ag.NodeObj.Skill);
                    }
                }
            }
            //------------------------------------------
        }

        // PC Input......// if (Ag.mPlatform == Ag.Platform.OSX || !Ag.IsSmartDevice ()) {//[2012:11:9:ljk]
        if (!Ag.IsSmartDevice())   //[2012:11:9:ljk]

        {
            if (mStage.WillInputDrag())          // Goul keeper Direction...
            {
                if (AgStt.mgGameTutorial)
                {
                    if ((Ag.mRound == 1 && mKeeperDragFlag) || (Ag.mRound == 2 && mKeeperDragFlag))
                    {
                        GameInput();
                    }
                }
                else
                {
                    GameInput();
                }
            }
            if (Input.GetMouseButtonDown(0))      // Skill Input
            {
                if (mStage.TouchProcess())
                {
                    if (curStt == "GameDir")
                    {
                        Ag.NodeObj.Direction = Ag.mgDirection = myCard.GetPosition(mStage.mCursorPosition);
                        SetPlayerDir2();
                    }
                    if (curStt == "GameSkl")
                    {
                        Ag.NodeObj.Skill = Ag.mgSkill = myCard.GetPosition(mStage.mCursorPosition);

                        if (myCard.WAS.grade == "S")
                        {
                            Ag.NodeObj.Skill = Ag.mgSkill += 1;
                        }

//                        if (myCard.WAS.grade == "S") {  // 4 Debugging
//                            if (myCard.WAS.isKicker)
//                                Ag.NodeObj.Skill = Ag.mgSkill = 3;
//                            else
//                                Ag.NodeObj.Skill = Ag.mgSkill += 1;
//                        }

                        if (!Ag.mgIsKick && Ag.mgSkill == 3)
                        {
                            Ag.LogIntenseWord("     (!Ag.mgIsKick && Ag.mgSkill == 3)   Case ::  Set Skill to ... 2 ");
                            Ag.NodeObj.Skill = Ag.mgSkill = 2;
                        }
                        Ag.LogString("  Touched >>>>>    Card : " + myCard.WAS.grade + "     Ag.mgSkill :: " + Ag.mgSkill + "       Ag.NodeObj.Skill :: " + Ag.NodeObj.Skill);
                    }
                }
            }
        }
    }