Beispiel #1
0
    public void UpdateHitterItem(JoinQuizInfo quizInfo)
    {
//		List<GameObject>list = mMatchPlaying.GetComponent<ScriptMatchPlaying>().mQuizListItems;
        ScriptItemHitterHighlight[] hitterArr = mMatchPlaying.GetComponent <ScriptMatchPlaying>()
                                                .mList.GetComponentsInChildren <ScriptItemHitterHighlight>();
        foreach (ScriptItemHitterHighlight hitterItem in hitterArr)
        {
//			ScriptItemHitterHighlight hitterItem = item.GetComponent<ScriptItemHitterHighlight>();
            if (hitterItem != null &&
                hitterItem.mQuizInfo.quizListSeq == quizInfo.QuizListSeq)
            {
                if (hitterItem.mQuizInfo.resp == null)
                {
                    hitterItem.mQuizInfo.resp = new List <QuizRespInfo>();
                }

                QuizRespInfo respInfo = new QuizRespInfo();
                respInfo.respValue = quizInfo.SelectValue;
                hitterItem.mQuizInfo.resp.Add(respInfo);

                hitterItem.SetQuizResult(hitterItem.mQuizInfo);
                break;
            }
        }
    }
Beispiel #2
0
    public static void InitSimpleResult(GetSimpleResultEvent simpleEvent
                                        , ScriptBetting scriptBetting, ScriptQuizResult scriptQuizResult)
    {
        if (simpleEvent.Response.data == null ||
            simpleEvent.Response.data.Count < 1)
        {
            return;
        }

        QuizInfo quiz = null;

        foreach (QuizInfo quizInfo in QuizMgr.QuizList)
        {
            if (quizInfo.quizListSeq == simpleEvent.Response.data [0].quizListSeq)
            {
                quiz = quizInfo;
                break;
            }
        }
        if (quiz == null)
        {
            return;
        }

        Debug.Log("InitSimpleResult2");
        quiz.quizValue = simpleEvent.Response.data [0].quizValue;

        quiz.resp = new List <QuizRespInfo> ();
        QuizRespInfo tmpInfo;

        if (simpleEvent.Response.data.Count > 1)
        {
            //got 2 answers
            tmpInfo                   = new QuizRespInfo();
            tmpInfo.respValue         = simpleEvent.Response.data[1].respValue;
            tmpInfo.expectRewardPoint = int.Parse(simpleEvent.Response.data[1].rewardPoint);
            quiz.resp.Add(tmpInfo);
        }

        tmpInfo                   = new QuizRespInfo();
        tmpInfo.respValue         = simpleEvent.Response.data[0].respValue;
        tmpInfo.expectRewardPoint = int.Parse(simpleEvent.Response.data[0].rewardPoint);
        quiz.resp.Insert(0, tmpInfo);

        if (ShowQuizResult(quiz, simpleEvent, scriptQuizResult))
        {
            scriptQuizResult.InitParticle();
        }

        scriptBetting.UpdateHitterItem(quiz);
    }
Beispiel #3
0
    public static void InitSimpleResult(GetSimpleResultEvent simpleEvent
                                        , ScriptBetting scriptBetting, ScriptQuizResult scriptQuizResult)
    {
        Debug.Log("InitSimpleResult");
        if (simpleEvent.Response.data == null ||
            simpleEvent.Response.data.Count < 1)
        {
            Debug.Log("return");
            return;
        }

        QuizInfo quiz = null;

        foreach (QuizInfo quizInfo in QuizMgr.QuizList)
        {
            if (quizInfo.quizListSeq == simpleEvent.Response.data [0].quizListSeq)
            {
                quiz = quizInfo;
                break;
            }
        }
        if (quiz == null)
        {
            Debug.Log("return re");
            return;
        }

        quiz.quizValue = simpleEvent.Response.data [0].quizValue;

        if (simpleEvent.Response.data[0].isCancel > 0)
        {
            quiz.resultMsg = simpleEvent.Response.data[0].resultMsg;
            Debug.Log("simpleEvent.Response.data[0].respStatus : " + simpleEvent.Response.data[0].respStatus);
        }
        if (simpleEvent.Response.data [0].respStatus > 0 ||
            simpleEvent.Response.data [0].isCancel > 0)
        {
            quiz.resp = new List <QuizRespInfo> ();
            QuizRespInfo tmpInfo;
            if (simpleEvent.Response.data.Count > 1)
            {
                //got 2 answers
                tmpInfo                   = new QuizRespInfo();
                tmpInfo.respValue         = simpleEvent.Response.data [1].respValue;
                tmpInfo.expectRewardPoint = int.Parse(simpleEvent.Response.data [1].rewardPoint);
                quiz.resp.Add(tmpInfo);
            }

            tmpInfo                   = new QuizRespInfo();
            tmpInfo.respValue         = simpleEvent.Response.data [0].respValue;
            tmpInfo.expectRewardPoint = int.Parse(simpleEvent.Response.data [0].rewardPoint);
            quiz.resp.Insert(0, tmpInfo);
            Debug.Log("simpleEvent.Response.data[0].isCancel : " + simpleEvent.Response.data [0].isCancel);
            if (ScriptMainTop.OpenBettingCheck)
            {
                if (simpleEvent.Response.data [0].isCancel > 0)
                {
                    ShowQuizResult(quiz, simpleEvent, scriptQuizResult);
                }
                else
                {
//			if(simpleEvent.Response.data[0].isCancel < 1){
                    if (ShowQuizResult(quiz, simpleEvent, scriptQuizResult))
                    {
                        scriptQuizResult.InitParticle();
                    }
                }
            }
        }

        scriptBetting.UpdateHitterItem(quiz);
    }
Beispiel #4
0
    //    public void RefreshDatas()
    //    {
    //        SetQuizResult (mQuizInfo);
    //    }

    public void SetQuizResult(QuizInfo quizInfo)
    {
        mQuizInfo = quizInfo;

        mLblReward.SetActive(false);

        if (quizInfo.quizValue.Length > 0)
        {
            Debug.Log("quizValue : " + quizInfo.quizValue);
            int idx = int.Parse(quizInfo.quizValue) - 1;
            mLblResult.GetComponent <UILabel>().text = quizInfo.order[idx].description;

            bool         isCorrect = false;
            QuizRespInfo resp      = null;
            if (quizInfo.resp != null)
            {
                for (int i = 0; i < quizInfo.resp.Count; i++)
                {
                    resp = quizInfo.resp[i];
                    if (resp.respValue.Equals(quizInfo.quizValue))
                    {
                        isCorrect = true;
                        break;
                    }
                }
            }

            if (isCorrect)
            {
                mLblReward.SetActive(true);

                mLblSelect1.SetActive(false);
                mLblSelect2_1.SetActive(false);
                mLblSelect2_2.SetActive(false);

                mLblReward.GetComponent <UILabel>().text = UtilMgr.AddsThousandsSeparator(resp.expectRewardPoint);

                return;
            }
        }
        else if (quizInfo.resultMsg.Length > 0)
        {
            Debug.Log("quiz cancel");
            mLblResult.GetComponent <UILabel>().text = quizInfo.resultMsg;
            //            mLblSelect1.SetActive(true);
            //            mLblSelect1.GetComponent<UILabel> ().text = "X";
        }
        try{
            if (quizInfo.resp == null ||
                quizInfo.resp.Count == 0)
            {
                Debug.Log("quiz1");
                mLblSelect1.SetActive(false);
                mLblSelect2_1.SetActive(false);
                mLblSelect2_2.SetActive(false);
            }
            else if (quizInfo.resp.Count == 1 &&
                     quizInfo.resp[0].respValue.Length > 0)
            {
                Debug.Log("quiz2");
                mLblSelect1.SetActive(true);

                mLblSelect2_1.SetActive(false);
                mLblSelect2_2.SetActive(false);

                Debug.Log("quizInfo.resp[0].respValue : " + quizInfo.resp[0].respValue);
                int respValue = int.Parse(quizInfo.resp[0].respValue) - 1;
                mLblSelect1.GetComponent <UILabel>().text = quizInfo.order[respValue].description;
            }
            else if (quizInfo.resp.Count == 2)
            {
                Debug.Log("quiz3");
                mLblSelect1.SetActive(false);

                mLblSelect2_1.SetActive(true);
                int respValue = int.Parse(quizInfo.resp[0].respValue) - 1;
                mLblSelect2_1.GetComponent <UILabel>().text = quizInfo.order[respValue].description;
                mLblSelect2_2.SetActive(true);

                Debug.Log("quizInfo.resp[1].respValue : " + quizInfo.resp[1].respValue);
                respValue = int.Parse(quizInfo.resp[1].respValue) - 1;
                mLblSelect2_2.GetComponent <UILabel>().text = quizInfo.order[respValue].description;
            }
        }
        catch {
            Debug.Log("Out of range");
        }
    }
Beispiel #5
0
    public void ResetList(Vector3 vector3, Vector2 vector2)
    {
        Debug.Log("list Cnt : " + QuizMgr.QuizList.Count);
        mGameRoundCounter = 99;
        foreach (QuizInfo quizInfo in QuizMgr.QuizList)
        {
            quizInfo.mShowInningFlag = false;
            if (quizInfo.typeCode.Contains("_QZD_"))
            {
                if (mGameRoundCounter > quizInfo.gameRound)
                {
                    if (mGameRoundCounter < 99)
                    {
                    }
                    else
                    {
                        mGameRound  = quizInfo.gameRound;
                        mInningType = quizInfo.inningType;
                    }
                    mGameRoundCounter        = quizInfo.gameRound;
                    mInningCounter           = quizInfo.inningType;
                    quizInfo.mShowInningFlag = true;
                }
                else if (mInningCounter != quizInfo.inningType)
                {
                    mInningCounter           = quizInfo.inningType;
                    quizInfo.mShowInningFlag = true;
                }
            }
        }
        ScriptMainTop.MyPoint = 0;
        Debug.Log("MyPoint Reset");
        QuizRespInfo resp = null;

        for (int i = 0; i < mEventProgQuiz.Response.data.quiz.Count; i++)
        {
            QuizInfo quizInfo2 = mEventProgQuiz.Response.data.quiz[i];
            for (int a = 0; a < quizInfo2.resp.Count; a++)
            {
                resp = quizInfo2.resp[a];
                if (resp.respValue.Equals(quizInfo2.quizValue))
                {
                    ScriptMainTop.MyPoint += resp.expectRewardPoint;
                    break;
                }
            }
        }

//		for (int i=0; i<mEventProgQuiz.Response.data.quiz.Count; i++) {
//			Debug.Log ("mEventProgQuiz.Response.data.quiz [0].gameRound  : "+mEventProgQuiz.Response.data.quiz [i].gameRound);
//		}


        Debug.Log("mEventProgQuiz.Response.data.quiz : " + mEventProgQuiz.Response.data.quiz.Count);
//		if (mEventProgQuiz.Response.data.quiz.Count <= 0) {
//			TF_Landing.GetComponent<LandingManager>().GetLineUp();
//		}
        Debug.Log("UtilMgr.gameround is " + UtilMgr.gameround);
        if (UtilMgr.gameround == 0 && mEventProgQuiz.Response.data.quiz != null)
        {
            if (mEventProgQuiz.Response.data.quiz [0].gameRound != null)
            {
                if (mEventProgQuiz.Response.data.quiz.Count > 0)
                {
                    //					transform.root.FindChild("TF_Highlight").FindChild("MatchPlaying").FindChild("ListHighlight").FindChild("Label").gameObject.SetActive(false);
                    //				Debug.Log("(mEventProgQuiz.Response.data.quiz [0].gameRound) : " + (mEventProgQuiz.Response.data.quiz [0].gameRound));
                    //				Debug.Log("(mEventProgQuiz.Response.data.quiz [0].inningType) : " + (mEventProgQuiz.Response.data.quiz [0].inningType));
                    UtilMgr.gameround = (((mEventProgQuiz.Response.data.quiz [0].gameRound) * 2) + (mEventProgQuiz.Response.data.quiz [0].inningType - 1));
                    if (UtilMgr.gameround > 1)
                    {
                        if (UserMgr.Schedule.myEntryFee != null)
                        {
                            if (int.Parse(UserMgr.Schedule.myEntryFee) > 0)
                            {
                                TF_Landing.GetComponent <LandingManager> ().GetRank();
                            }
                        }
                    }
                }
            }
        }
        else
        {
            if (mEventProgQuiz.Response.data.quiz [0].gameRound != null)
            {
                if (UtilMgr.gameround < ((mEventProgQuiz.Response.data.quiz [0].gameRound) * 2) + (mEventProgQuiz.Response.data.quiz [0].inningType - 1) && UtilMgr.gameround > 0)
                {
                    TF_Landing.GetComponent <LandingManager> ().GetRank();
                }
                UtilMgr.gameround = ((mEventProgQuiz.Response.data.quiz [0].gameRound) * 2) + (mEventProgQuiz.Response.data.quiz [0].inningType - 1);
            }
        }
        mList.GetComponent <UIDraggablePanel2> ().Init(QuizMgr.QuizList.Count,
                                                       delegate(UIListItem item, int index) {
            ScriptItemHitterHighlight sItem = item.Target.GetComponent <ScriptItemHitterHighlight>();
            QuizInfo quizInfo = mEventProgQuiz.Response.data.quiz[index];

            sItem.Init(this, quizInfo, transform.FindChild("ItemDetail").gameObject);
            item.Target.transform.FindChild("Round").gameObject.SetActive(false);
            if (quizInfo.mShowInningFlag)
            {
                item.Target.transform.FindChild("Round").gameObject.SetActive(true);
                item.Target.transform.FindChild("Round").FindChild("LblRound")
                .GetComponent <UILabel>().text = "" + quizInfo.gameRound;
                if (quizInfo.inningType == 0)
                {
                    item.Target.transform.FindChild("Round").FindChild("SprArrow")
                    .GetComponent <UISprite>().flip = UIBasicSprite.Flip.Nothing;
                }
                else
                {
                    item.Target.transform.FindChild("Round").FindChild("SprArrow")
                    .GetComponent <UISprite>().flip = UIBasicSprite.Flip.Vertically;
                }
            }
        });
        mList.GetComponent <UIDraggablePanel2> ().ResetPosition();
//		if(vector3 == Vector3.zero){
//			Debug.Log("no vector");
//		} else{
//			Debug.Log("vector : "+vector3.y);
//			mList.transform.localPosition = vector3;
//			mList.GetComponent<UIPanel>().clipOffset = vector2;
//		}
    }
Beispiel #6
0
//	public void RefreshDatas()
//	{
//		SetQuizResult (mQuizInfo);
//	}

    public void SetQuizResult(QuizInfo quizInfo)
    {
        mQuizInfo = quizInfo;

        mLblReward.SetActive(false);
        mLblSelect1.SetActive(false);
        mLblSelect2_1.SetActive(false);
        mLblSelect2_2.SetActive(false);

        if (quizInfo.quizValue.Length > 0)
        {
            int idx = int.Parse(quizInfo.quizValue) - 1;
            mLblResult.GetComponent <UILabel>().text = quizInfo.order[idx].description;

            bool         isCorrect = false;
            QuizRespInfo resp      = null;
            if (quizInfo.resp != null)
            {
                for (int i = 0; i < quizInfo.resp.Count; i++)
                {
                    resp = quizInfo.resp[i];
                    if (resp.respValue.Equals(quizInfo.quizValue))
                    {
                        isCorrect = true;
                        break;
                    }
                }
            }

            if (isCorrect)
            {
                mLblReward.SetActive(true);
                mLblReward.GetComponent <UILabel>().text = UtilMgr.AddsThousandsSeparator(resp.expectRewardPoint);
            }
            return;
        }
        else if (quizInfo.resultMsg.Length > 0)
        {
            //need modify
            mLblResult.GetComponent <UILabel>().text = quizInfo.resultMsg;
            mLblSelect1.SetActive(true);
            mLblSelect1.GetComponent <UILabel> ().text = "X";
        }

        if (quizInfo.resp == null)
        {
        }
        else if (quizInfo.resp.Count == 1)
        {
            mLblSelect1.SetActive(true);
            int respValue = int.Parse(quizInfo.resp[0].respValue) - 1;
            mLblSelect1.GetComponent <UILabel>().text = quizInfo.order[respValue].description;
        }
        else if (quizInfo.resp.Count == 2)
        {
            mLblSelect2_1.SetActive(true);
            int respValue = int.Parse(quizInfo.resp[0].respValue) - 1;
            mLblSelect2_1.GetComponent <UILabel>().text = quizInfo.order[respValue].description;
            mLblSelect2_2.SetActive(true);
            respValue = int.Parse(quizInfo.resp[1].respValue) - 1;
            mLblSelect2_2.GetComponent <UILabel>().text = quizInfo.order[respValue].description;
        }
    }