예제 #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);
                    }
                }
            }
        }
    }
    public void KakaoPlayCoolTime()
    {
        //Debug.Log ("Ag.mySelf.myRank.WAS.contWinNum   " +  Ag.mySelf.myRank.WAS.contWinNum);
        Ag.mySelf.ContWinCoolTimeRemain(out Contmm, out Contss);


        if (Ag.mySelf.myRank.WAS.contWinNum > 0 && Ag.mySelf.ContWinCoolTimeRemainPercent() > 0)
        {
            mRscrcMan.FindChild(dicMenuList ["Ui_kickoff"], "Panel_bottom/bundle_rightbtn/btn1_ready", true);   // alter
            mRscrcMan.FindChild(dicMenuList ["Ui_kickoff"], "Panel_bottom/bundle_rightbtn/btn1_ready2", false); // default
            //BtnKickOff.SetVisible (deflt: false, alt: true);
            dicMenuList ["Label_victorytime"].SetActive(true);
            dicMenuList ["Label_victorynum"].SetActive(true);
            dicMenuList ["Progress_victory"].SetActive(true);
            dicMenuList ["Progress_victory"].transform.FindChild("Foreground").GetComponent <UISprite> ().fillAmount = Ag.mySelf.ContWinCoolTimeRemainPercent() / 100;
            dicMenuList ["Label_victorytime"].GetComponent <UILabel> ().text = Contmm.ToFixedWidth(2) + ":" + Contss.ToFixedWidth(2);
            dicMenuList ["Label_victorynum"].GetComponent <UILabel> ().text  = (Ag.mySelf.myRank.WAS.contWinNum + 1).ToString() + WWW.UnEscapeURL("%EC%97%B0%EC%8A%B9%20%EB%8F%84%EC%A0%84");
        }
        else
        {
            mRscrcMan.FindChild(dicMenuList ["Ui_kickoff"], "Panel_bottom/bundle_rightbtn/btn1_ready", false);  // alter
            mRscrcMan.FindChild(dicMenuList ["Ui_kickoff"], "Panel_bottom/bundle_rightbtn/btn1_ready2", true);  // default
            //BtnKickOff.SetVisible (deflt: true, alt: false);
            dicMenuList ["Label_victorytime"].SetActive(false);
            dicMenuList ["Label_victorynum"].SetActive(false);
            dicMenuList ["Progress_victory"].SetActive(false);
        }



//        if (Ag.mySelf.FreeCouponLimitDT > System.DateTime.Now) {
//            //dicMenuList ["heart_freebundle_eaHeart"].GetComponent<UILabel> ().text = "x" + KakaoGameUserInfo.Instance.heart.ToString ();
//            Hours = (int)(Ag.mySelf.FreeCouponLimitDT - DateTime.Now).TotalHours;
//            Minitues = (Ag.mySelf.FreeCouponLimitDT - DateTime.Now).Minutes;
//            Second = (Ag.mySelf.FreeCouponLimitDT - DateTime.Now).Seconds;

        if (Ag.mySelf.IsFreeCouponRemain)
        {
            //dicMenuList ["heart_freebundle_eaHeart"].GetComponent<UILabel> ().text = "x" + KakaoGameUserInfo.Instance.heart.ToString ();
            TimeSpan remainTime = Ag.mySelf.FreeCouponTS;
            Hours    = (int)remainTime.TotalHours;
            Minitues = remainTime.Minutes;
            Second   = remainTime.Seconds;

            mRscrcMan.FindChild(dicMenuList ["Panel_top"], "heart_freebundle/heart_progress/Progress Bar/Label_refreshtime", true).GetComponent <UILabel> ().text = Hours.ToString() + ":" + Minitues.ToFixedWidth(2) + ":" + Second.ToFixedWidth(2);
            mRscrcMan.FindChild(dicMenuList ["Panel_top"], "heart_freebundle/heart_progress/heart_action", false);
            mRscrcMan.FindChild(dicMenuList ["Panel_top"], "heart_freebundle/heart_progress/heart_action2", false);

            //  Debug.Log (Ag.mySelf.HeartPercent () + "Percent :: " + Percent + "Hours " + Hours + "Minitues " + Minitues   + "Second " + Second);
            //  Debug.Log (Ag.mySelf.HeartPercent () + "Percent :: " + Percent + "Hours " + Hours.ToFixedWidth(2) + "Minitues " + Minitues.ToFixedWidth(2)  + "Second " + Second.ToFixedWidth(2));
        }
        else
        {
            int mm, ss, mm2, ss2;
            Ag.mySelf.HeartPercent(out mm, out ss);
            float  percentHrt = Ag.mySelf.HeartPercent();
            string pct = " %", divider = ".", FontColor = "";
            if (percentHrt < 0)
            {
                Ag.mySelf.HeartCoolTime(out mm, out ss);
                //FontColor = "[#FF0000]";
                pct     = " ";
                divider = " : ";
            }
            mm = Math.Abs(mm);
            ss = Math.Abs(ss);

            Percent = Ag.mySelf.HeartCoolTime();  // %
            //            Debug.Log (ss + "HeartPercent");



            dicMenuList ["heart_freebundle_Label_refreshtime"].GetComponent <UILabel> ().text = "H  " + Percent + " %, S " + ss;
            mRscrcMan.FindChild(dicMenuList ["Panel_top"], "heart_freebundle/heart_progress/Progress Bar/Foreground", true).GetComponent <UISprite> ().fillAmount = (1000 - ((1000 - Percent) * 0.8f)) / 1000;

            if (PhysicalBarCheck("HeartSpeedUp"))
            {
                mRscrcMan.FindChild(dicMenuList ["Panel_top"], "heart_freebundle/heart_progress/heart_action2", mm < 100 ? true : false);
                mRscrcMan.FindChild(dicMenuList ["Panel_top"], "heart_freebundle/heart_progress/heart_action", false);
            }
            else
            {
                mRscrcMan.FindChild(dicMenuList ["Panel_top"], "heart_freebundle/heart_progress/heart_action", mm < 100 ? true : false);
                mRscrcMan.FindChild(dicMenuList ["Panel_top"], "heart_freebundle/heart_progress/heart_action2", false);
            }


            if (percentHrt < 0)
            {
                mRscrcMan.FindChild(dicMenuList ["Panel_top"], "heart_freebundle/heart_progress/Progress Bar/Label_refreshtime", true).GetComponent <UILabel> ().color = Color.red;
                mRscrcMan.FindChild(dicMenuList ["Panel_top"], "heart_freebundle/heart_progress/Progress Bar/Label_refreshtime", true).GetComponent <UILabel> ().text  = mm.ToFixedWidth(2) + divider + ss.ToFixedWidth(2) + pct;
                dicMenuList ["LPanel_shop_table_glove"].transform.FindChild("table_disable/btn_1").gameObject.SetActive(false);

                /*
                 * mRscrcMan.FindChild (dicMenuList ["Panel_top"], "heart_freebundle/heart_progress/Progress Bar/Label_refreshtime", true).GetComponent<UILabel> ().text =
                 *
                 *  WWW.UnEscapeURL ("%EC%B2%B4%EB%A0%A5") + "[FF0000]" + Ag.mySelf.HeartCoolTimeSec ().ToString () + "[FFFFFF]" + "/" +
                 * (PhysicalBarCheck ("HeartLimitUp") ?
                 *  AgStt.CTHeartMaxDoubled.ToString () :
                 *      AgStt.CTHeartMaxSeconds.ToString ());//mm.ToFixedWidth (2) + divider + ss.ToFixedWidth (2) + pct;
                 */
            }
            else
            {
                mRscrcMan.FindChild(dicMenuList ["Panel_top"], "heart_freebundle/heart_progress/Progress Bar/Label_refreshtime", true).GetComponent <UILabel> ().color = Color.white;
                mRscrcMan.FindChild(dicMenuList ["Panel_top"], "heart_freebundle/heart_progress/Progress Bar/Label_refreshtime", true).GetComponent <UILabel> ().text  =
                    WWW.UnEscapeURL("%EC%B2%B4%EB%A0%A5") + Ag.mySelf.HeartCoolTimeSec().ToString() + "/" +
                    (PhysicalBarCheck("HeartLimitUp") ? AgStt.CTHeartMaxDoubled.ToString() : AgStt.CTHeartMaxSeconds.ToString());//mm.ToFixedWidth (2) + divider + ss.ToFixedWidth (2) + pct;
                if (percentHrt > 99.9)
                {
                    dicMenuList ["LPanel_shop_table_glove"].transform.FindChild("table_disable/btn_1").gameObject.SetActive(true);
                }
                else
                {
                    dicMenuList ["LPanel_shop_table_glove"].transform.FindChild("table_disable/btn_1").gameObject.SetActive(false);
                }
                //mRscrcMan.FindChild (dicMenuList ["Panel_top"], "heart_freebundle/heart_progress/Progress Bar/Label_refreshtime", true).GetComponent<UILabel> ().text = mm + divider + ss + pct;
            }
            //            Debug.Log (Percent + "Percent");
            //if (GUI.Button (myGUI.DivideRect (rect006, colEA, colN++), "H  " + mm + ":" + ss)) {

            //Debug.Log ("Percent :: " + Percent + "HeartCoolTime     " + mm +"    " + ss);
        }
    }