public void Init(QuizInfo quizInfo) { Debug.Log("Init"); mListJoin.Clear(); // quizInfo = quizInfo; SetHitter(); Debug.Log("Hitter"); SetPitcher(); Debug.Log("Pitcher"); SetBases(); Debug.Log("Bases"); SetBtns(); Debug.Log("Btns"); mSprBetting.SetActive(false); mStartTime = System.DateTime.Now.ToFileTime(); mTimeOut = false; // mStartSec = System.DateTime.Now.Second; // mStartMilSec = System.DateTime.Now.Millisecond / 10; TweenAlpha.Begin(mSprComb, 0f, 0f); TweenAlpha.Begin(mSprComb, 1f, 1.0f); transform.FindChild("Lightning Spark").gameObject.SetActive(false); mSprBetting.SetActive(false); }
public QuizInfo GetFullInfo() { QuizInfo info = new QuizInfo(); SqlConnection connection = new SqlConnection(_connectionString); using (SqlDataAdapter quizInfoAdapter = new SqlDataAdapter(GET_QUIZ_INFO_COMMAND, connection)) { DataTable quizInfoTable = new DataTable(); quizInfoAdapter.Fill(quizInfoTable); roundIndex = Convert.ToInt32(quizInfoTable.Rows[0].ItemArray[0]); info.RoundIndex = roundIndex; startQuestionIndex = Convert.ToInt32(quizInfoTable.Rows[0].ItemArray[1]); } using (SqlDataAdapter playersAdapter = new SqlDataAdapter(GET_PLAYERS_INFO_COMMAND, connection)) { DataTable playersTable = new DataTable(); playersAdapter.Fill(playersTable); foreach (DataRow player in playersTable.Rows) { info.PlayersNames.Add(player.ItemArray[1].ToString()); info.PlayersPoints.Add(Convert.ToInt32(player.ItemArray[2])); } } connection.Close(); currentPlayersInfo = info; return(info); }
private void SendQuizInfo() { QuizInfo quiz_info = QuizInfo.CreateUserInfo(TimeSpan.FromMilliseconds(event_seconds_).Seconds); log_.Debug(quiz_info.ToString()); Broadcast_Data_(EwkProtoFactory.CreateIEwkProtocol <QuizInfo>(ProtocolEnum.QuizInfo, quiz_info).GetBytes); }
private OwnerShortInfoDto CreateOwnerShortInfoDto(QuizInfo quizInfo) => new OwnerShortInfoDto { FirstName = quizInfo.Owner.FirstName, LastName = quizInfo.Owner.LastName, AvatarBlobKey = FileUtils.GetContent(quizInfo.Owner.AvatarPath) };
/// <summary> /// クイズオブジェクトを配置し、セットアップする /// </summary> /// <param name="quizId"></param> public void SetupQuizGroup(string quizId) { DestroyQuizObject(); // Setupに必要なクイズ情報を取得 var quizInfo = GameUtil.GetGameSceneController().QuizInfoList.Where(x => x.Id == quizId).FirstOrDefault(); var filePath = quizInfo.QuestionObjectFilePath; _currentQuizInfo = quizInfo; // QuizQuestionCanvasに質問オブジェクトを読み込む GameObject questionObj = (GameObject)Resources.Load(filePath); GameObject prefab = (GameObject)Instantiate(questionObj); prefab.transform.SetParent(_questionCanvas.transform, false); _questionObject = prefab; _questionController = prefab.GetComponent <QuestionController>(); // 質問の初期化 var question = _questionObject.GetComponent <QuestionController>(); question.SetQuestionParam(quizInfo); _quizGroup.SetActive(true); // 最初はシナリオ画面 _currentSenarioLabel = "Test5"; ChangeQuizMode(QuizMode.Scenario); UtageUtil.GetNazotokiAdvEngineController().JumpScenario("Test5"); }
public static void AddQuizList(QuizInfo quiz) { QuizList.Insert(0, quiz); if (SequenceQuiz < quiz.quizListSeq) { SequenceQuiz = quiz.quizListSeq; } }
public void AddQuizList(QuizInfo quizInfo) { Debug.Log("AddQuizList"); QuizMgr.AddQuizList(quizInfo); ResetList(); mGameRound = quizInfo.gameRound; mInningType = quizInfo.inningType; }
public static QuizInfoVM SetSubData(QuizInfo data, Guid aid) { var model = QuizInfoVM.MToVM(data); model.QuizStatus = StatusTypesReferencesVM.MToVM(StatusTypesReferencesService.GetByID(data.QuizStatus)); model.Status = StatusTypesReferencesVM.MToVM(StatusTypesReferencesService.GetByID(data.Status)); model.DateTimeStorage = DateTimeStorageVM.MToVM(DateTimeStorageService.GetByID(data.DateTimeStorageID)); return(model); }
public void OpenAnimation(QuizInfo quizInfo) { Debug.Log("OpenAnimation(QuizInfo quizInfo)"); //QuizMgr.QuizValue = 0; ScriptBettingItem.ClickCheck = false; Mark(quizInfo); //mBatting.transform.FindChild("SprHit") StartCoroutine(OpenAnimations()); }
public void SetList(QuizInfo quiz) { mSelectedQuiz = quiz; mList.GetComponent <UIDraggablePanel2>().Init(1, delegate(UIListItem item, int index){ ScriptItemHitterHighlight sItem = item.Target.GetComponent <ScriptItemHitterHighlight>(); sItem.Init(this, mSelectedQuiz, transform.FindChild("ItemDetail").gameObject); item.Target.transform.FindChild("Round").gameObject.SetActive(false); }); mList.GetComponent <UIDraggablePanel2>().ResetPosition(); }
public bool Init(List <SimpleResultInfo> listResult) { double rewardPoint = 0; int betPoint = 0; foreach (SimpleResultInfo resultInfo in listResult) { rewardPoint += double.Parse(resultInfo.rewardPoint); betPoint += int.Parse(resultInfo.betPoint); } QuizInfo quizInfo = null; foreach (QuizInfo quiz in QuizMgr.QuizList) { if (listResult[0].quizListSeq == quiz.quizListSeq) { quizInfo = quiz; break; } } string info = quizInfo.playerName + " / "; int quizValue = int.Parse(listResult [0].quizValue); info += quizInfo.order [quizValue - 1].description; mLblTopRight.GetComponent <UILabel>().text = info; int rand = UnityEngine.Random.Range(1, 3); if (rewardPoint > 0) { mSprLeft.GetComponent <UISprite>().color = COLOR_CORRECT; mSprBtmRight.GetComponent <UISprite>().color = COLOR_CORRECT; mLblLeft.GetComponent <UILabel>().text = transform.GetComponent <PlayMakerFSM>().FsmVariables.FindFsmString("Correct" + rand).Value; mLblBtmRight.GetComponent <UILabel>().text = "" + rewardPoint; double userGoldenBall = double.Parse(UserMgr.UserInfo.userGoldenBall) + rewardPoint; UserMgr.UserInfo.userGoldenBall = "" + userGoldenBall; return(true); } else { mSprLeft.GetComponent <UISprite>().color = COLOR_WRONG; mSprBtmRight.GetComponent <UISprite>().color = COLOR_WRONG; mLblLeft.GetComponent <UILabel>().text = transform.GetComponent <PlayMakerFSM>().FsmVariables.FindFsmString("Wrong" + rand).Value; mLblBtmRight.GetComponent <UILabel>().text = "-" + betPoint; return(false); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { buttonConnector = new ButtonModuleConnector(); buttonConnector.OnModuleConnectionChange += ButtonConnector_OnModuleConnectionChange; buttonConnector.OnNewPortNames += ButtonConnector_OnNewPortNames; buttonConnector.PortName = "COM4"; buttonConnector.Init(); registrationManager = new RegistrationManager(); registrationManager.Init(buttonConnector); registrationManager.OnPlayerDisable += RegistrationManager_OnPlayerDisable; registrationManager.OnPlayerRegistrated += RegistrationManager_OnPlayerRegistrated; dbWorker = new DataBaseWorker(); dbWorker.Init(); QuizInfo playersInfo = dbWorker.GetFullInfo(); RoundNumber = playersInfo.RoundIndex; quizManager = new QuizManager(); quizManager.OnNewQuestion += QuizManager_OnNewQuestion; quizManager.OnPlayerButtonClicked += QuizManager_OnPlayerButtonClicked; quizManager.OnRightAnswer += QuizManager_OnRightAnswer; quizManager.OnWrongAnswer += QuizManager_OnWrongAnswer; quizManager.OnRoundEnd += QuizManager_OnRoundEnd; quizManager.Init(dbWorker.GetQuestions(), buttonConnector); if (playersInfo.PlayersNames.Count == 0) { AddPlayer(); AddPlayer(); } else { for (int i = 0; i < playersInfo.PlayersNames.Count; ++i) { AddPlayer(playersInfo.PlayersNames[i]); AddPoints(i, playersInfo.PlayersPoints[i]); } } MediaBlock.LoadedBehavior = MediaState.Manual; MediaBlock.UnloadedBehavior = MediaState.Manual; MediaBlock.Volume = 0.5f; RightAnswerMediaBlock.LoadedBehavior = MediaState.Manual; RightAnswerMediaBlock.UnloadedBehavior = MediaState.Manual; RightAnswerMediaBlock.Volume = 0.5f; Sound.LoadedBehavior = MediaState.Manual; Sound.UnloadedBehavior = MediaState.Manual; Sound.Volume = 0.5f; Sound.Stop(); }
void SetResultGraph() { int i = 0; // List<QuizResultGlobal> globalList = new List<QuizResultGlobal>(); // List<QuizResultGlobal> friendsList = new List<QuizResultGlobal>(); // // QuizResultGlobal global = new QuizResultGlobal(); QuizInfo myQuiz = null; int resp1 = 0; int resp2 = 0; foreach (QuizInfo quiz in QuizMgr.QuizList) { if (quiz.quizListSeq == mResponse.data.global[0].quizListSeq) { myQuiz = quiz; } } if (myQuiz != null && myQuiz.resp != null && myQuiz.resp.Count > 0) { resp1 = int.Parse(myQuiz.resp[0].respValue); if (myQuiz.resp.Count > 1) { resp2 = int.Parse(myQuiz.resp[1].respValue); } } for (; i < mResponse.data.global.Count; i++) { bool isMyChoice = false; if (mResponse.data.global[i].orderSeq == resp1 || mResponse.data.global[i].orderSeq == resp2) { isMyChoice = true; } Items[i].GetComponent <ScriptItemDetailGraph>().Init( mResponse.data.global[i], mResponse.data.friend[i], isMyChoice); } for (; i < 8; i++) { Items[i].GetComponent <ScriptItemDetailGraph>().gameObject.SetActive(false); mPosJoinBar -= 30; mPosGuide -= 30; } mSprJoinBar.transform.localPosition = new Vector3(0, -mPosJoinBar, 0); }
private void SendQuizInfo(string quiz_question, string[] quiz_example) { QuizInfo quiz_info = QuizInfo.CreateUserInfo( quiz_question, quiz_example, TimeSpan.FromMilliseconds(event_seconds_).Seconds, game_info_.Current_Turn_ ); Broadcast_Data_(EwkProtoFactory.CreateIEwkProtocol <QuizInfo>(ProtocolEnum.QuizInfo, quiz_info).GetBytes); }
public JsonResult GetStudentQuizzes(int id) { var result = new List <QuizInfo>(); var quizzes = _repository.Get <Quiz>(); var userQuizzes = _repository.Get <QuizPass>(qp => qp.UserId == id); var quizBlocks = _repository.Get <QuizBlock>(); var quizQuestions = _repository.Get <QuizQuestion>(); var questions = _repository.Get <Question>(); var questionTypes = _repository.Get <QuestionType>(); var quizPasses = _repository.Get <QuizPass>(); var quizPassScores = _repository.Get <QuizPassScore>(); var autoQuestions = from qz in quizzes join qb in quizBlocks on qz.Id equals qb.QuizId join qq in quizQuestions on qb.Id equals qq.QuizBlockId join q in questions on qq.QuestionId equals q.Id join qt in questionTypes on q.QuestionTypeId equals qt.Id where qt.IsAutomatic group new { qz, qt } by qz.Id into grouped select new QuestionsAuto { QuizId = grouped.Key, IsAutomatic = grouped.Select(q => q.qt.IsAutomatic).Count() }; var passed = from q in quizzes join uq in userQuizzes on q.Id equals uq.QuizId join qb in quizBlocks on q.Id equals qb.QuizId join aq in autoQuestions on q.Id equals aq.QuizId join qps in quizPassScores on uq.Id equals qps.QuizPassId into temp from t in temp.DefaultIfEmpty() where uq.FinishTime != null select new QuizInfo { id = uq.Id, name = q.Name, state = t != null ? "Passed" : "In verification", questions = (int)qb.QuestionCount, verificationType = QuizInfo.SetVerificationType(aq.IsAutomatic, (int)qb.QuestionCount), otherDetails = q.Description, date = uq.FinishTime }; foreach (var item in passed) { result.Add(item); } return(Json(result, JsonRequestBehavior.AllowGet)); }
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); }
public void UpdateHitterItem(QuizInfo quiz) { List <GameObject> list = mMatchPlaying.GetComponent <ScriptMatchPlaying>().mQuizListItems; foreach (GameObject item in list) { ScriptItemHitterHighlight hitterItem = item.GetComponent <ScriptItemHitterHighlight>(); if (hitterItem != null && hitterItem.mQuizInfo.quizListSeq == quiz.quizListSeq) { hitterItem.SetQuizResult(quiz); break; } } }
public void UpdateHitterItem(QuizInfo quiz) { // 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 == quiz.quizListSeq) { hitterItem.SetQuizResult(quiz); break; } } }
public void AddQuizList(QuizInfo quizInfo) { mAccumulatedY = 0f; // mPosGuide = 0f; mPosGuide = (122 - 30f) / 2f; mPreItemSize = 122f; QuizMgr.AddQuizList(quizInfo); // QuizInfo quizInfo = quizEvent.Response.data.quiz[quizEvent.Response.data.quiz.Count-1]; if (quizInfo.gameRound == mGameRound && quizInfo.inningType == mInningType) { GameObject go = mQuizListItems [0]; RepositionItems(-go.GetComponent <BoxCollider2D> ().size.y); mQuizListItems.RemoveAt(0); NGUITools.Destroy(go); } // Debug.Log ("quizInfo.gameRound : " + quizInfo.gameRound + ", mGameRound : " + mGameRound); // Debug.Log ("quizInfo.inningType : " + quizInfo.inningType + ", mInningType : " + mInningType); AddQuizIntoList(quizInfo); mGameRound = quizInfo.gameRound; mInningType = quizInfo.inningType; GameObject obj = Instantiate(itemRound, new Vector3(0f, 0f, 0f), Quaternion.identity) as GameObject; mQuizListItems.Insert(0, obj); RepositionItems(obj.GetComponent <BoxCollider2D> ().size.y); obj.transform.parent = mList.transform; //.FindChild("Grid"); obj.transform.localScale = new Vector3(1f, 1f, 1f); if (mInningType == 0) { obj.transform.FindChild("LblTail").gameObject.SetActive(false); } else { obj.transform.FindChild("LblHead").gameObject.SetActive(false); } obj.transform.FindChild("LblRound").GetComponent <UILabel>().text = mGameRound + ""; obj.transform.localPosition = new Vector3(0f, 0f, 0f); mList.GetComponent <UIScrollView> ().ResetPosition(); }
public void Init(QuizInfo quizInfo) { Debug.Log("Init"); if (quizInfo != null) { transform.parent.FindChild("TF_Highlight").FindChild("MatchPlaying").FindChild("ListHighlight").FindChild("Label").gameObject.SetActive(false); if (!transform.parent.FindChild("GameObject").FindChild("TF_Landing").FindChild("Scroll View").FindChild("Playing").gameObject.activeSelf) { ScriptMainTop.LandingState = 2; transform.parent.FindChild("GameObject").FindChild("TF_Landing").GetComponent <LandingManager> ().Start(); } mListJoin.Clear(); // quizInfo = quizInfo; SetHitter(quizInfo); Debug.Log("Hitter"); SetPitcher(); Debug.Log("Pitcher"); //SetBases (); Debug.Log("Bases"); SetBtns(); Debug.Log("Btns"); mSprBetting.SetActive(false); mStartTime = System.DateTime.Now.ToFileTime(); mTimeOut = false; backCheck = true; // mStartSec = System.DateTime.Now.Second; // mStartMilSec = System.DateTime.Now.Millisecond / 10; TweenAlpha.Begin(mBatting, 0f, 0f); TweenAlpha.Begin(mBatting, 1f, 1.0f); mSpark1.SetActive(false); mSpark2.SetActive(false); mSprBetting.SetActive(false); mBtnBatter.GetComponent <ScriptBettingCard> ().Init(); mBtnPitcher.GetComponent <ScriptBettingCard> ().Init(); mBtnStrategy.GetComponent <ScriptBettingCard> ().Init(); mScrollView.transform.localPosition = new Vector3(0, -72f, 0); mScrollView.GetComponent <UIPanel> ().clipOffset = new Vector2(0, UtilMgr.GetScaledPositionY()); } }
public void Init(ScriptMatchPlaying matchPlaying, QuizInfo quizInfo, GameObject detailView) { isImgLoaded = false; mDetailView = detailView; mMatchPlaying = matchPlaying; mQuizInfo = quizInfo; if (mQuizInfo.typeCode.Contains("_QZC_")) { mLblName.transform.GetComponent <UILabel> ().text = mQuizInfo.subTitle; mLblNumber.SetActive(false); } else { mLblName.transform.GetComponent <UILabel> ().text = mQuizInfo.playerName; // int width = mLblName.transform.GetComponent<UILabel> ().width; float width = mQuizInfo.playerName.Length * 25; mLblNumber.transform.GetComponent <UILabel> ().text = "No." + mQuizInfo.playerNumber; // Vector3 pos = new Vector3(mLblName.transform.localPosition.x, // mLblName.transform.localPosition.y, // mLblName.transform.localPosition.z); // pos.x += width; Vector3 pos = mLblNumber.transform.localPosition; pos.x = -80f + width; mLblNumber.transform.localPosition = pos; } mLblReward.transform.GetComponent <UILabel> ().text = mQuizInfo.rewardDividend; string strImage = mQuizInfo.imageName; if (mQuizInfo.imagePath != null && mQuizInfo.imagePath.Length > 0) { strImage = mQuizInfo.imagePath + mQuizInfo.imageName; } WWW www = new WWW(Constants.IMAGE_SERVER_HOST + strImage); gameObject.SetActive(true); StartCoroutine(GetImage(www)); SetQuizResult(mQuizInfo); // isOpened = false; }
public void OpenBetting(QuizInfo quizInfo) { #if (UNITY_EDITOR) #elif (UNITY_ANDROID) #else #endif if (UtilMgr.HasBackEvent()) { UtilMgr.RunAllBackEvents(); } QuizMgr.QuizInfo = quizInfo; QuizMgr.IsBettingOpended = true; QuizMgr.JoinCount = 0; UtilMgr.SetBackEvent(new EventDelegate(this, "AnimateClosing")); mBetting.SetActive(true); mBetting.GetComponent <ScriptTF_Betting> ().Init(quizInfo); transform.GetComponent <PlayMakerFSM> ().SendEvent("OpenBetting"); transform.root.GetComponent <AudioSource>().PlayOneShot(mSoundOpenBet); }
public void InitQuizList(GetQuizEvent quizEvent) { QuizMgr.SetQuizList(mEventProgQuiz.Response.data.quiz); foreach (GameObject go in mQuizListItems) { go.transform.parent = null; NGUITools.DestroyImmediate(go); } mQuizListItems.Clear(); mFirstLoading = true; mAccumulatedY = 0f; mPosGuide = 0f; mPreItemSize = 30f; for (int i = 0; i < mEventProgQuiz.Response.data.quiz.Count; i++) { QuizInfo quizInfo = mEventProgQuiz.Response.data.quiz[i]; AddQuizIntoList(quizInfo); } mList.GetComponent <UIScrollView> ().ResetPosition(); mFirstLoading = false; }
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); }
// 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"); } }
/// <summary> /// クイズのパラメータをロードデータより読み込む /// </summary> /// <param name="quizInfo">クイズ情報</param> public void SetQuestionParam(QuizInfo quizInfo) { _correctAnswer = quizInfo.CorrectAnswer; }
public static void AddQuizList(QuizInfo quiz) { QuizMgr.QuizList.Insert(0, quiz); }
static bool ShowQuizResult(QuizInfo quiz, GetSimpleResultEvent simpleEvent, ScriptQuizResult scriptQuizResult) { Debug.Log(""); scriptQuizResult.GetComponent <PlayMakerFSM>().SendEvent("OpenResultEvent"); return(scriptQuizResult.GetComponent <ScriptQuizResult> ().Init(simpleEvent.Response.data)); }
public void Init(QuizInfo quizInfo) { transform.FindChild("Label").GetComponent <UILabel> ().text = quizInfo.quizTitle; }
void TestProtobuf() { // var model = new EwkProtocol<Person>(); //Object obj = new Object(); IDictionary <string, Object> dic_ = new Dictionary <string, Object>(); dic_["aaa"] = 7777 as Object; dic_["bbb"] = 9999 as Object; dic_["ccc"] = new List <int> { 1, 2, 3 } as Object; //dic_["ccc"] = 9999; //dic_["ddd"] = 9999; //dic_["eee"] = 9999; //dic_["fff"] = 9999; //dic_["ggg"] = 9999; Hashtable htable_ = new Hashtable(); dic_["aaa"] = 9999; dic_["bbb"] = 9999; dic_["ccc"] = 9999; dic_["ddd"] = 9999; dic_["eee"] = 9999; dic_["fff"] = 9999; dic_["ggg"] = 9999; IList <string> list_ = new List <string>(); list_.Add("hello"); list_.Add("asdf"); list_.Add("asdf111"); list_.Add("asdf222"); list_.Add("asdf333"); QuizInfo quiz_info = QuizInfo.CreateUserInfo(100); //AvatarInfo ai = AvatarInfo.CreateAvatarInfo(9999,9999,9999,9999,9999,9999); //EwkProtocol ewk_ = EwkProtocol.CreateEwkProtocol( ProtocolEnum.Res_Game_Change_Game_Mode, ai ); // string base64_ = ewk_.Input_Parameters_Base64; // byte[] string_bytes = Encoding.UTF8.GetBytes( base64_ ); //byte[] bytes = ProtocolUtility.SerializeForProtobuf<AvatarInfo>( ai ); //byte[] bytes = ProtocolUtility.SerializeForProtobuf<EwkProtocol>( //EwkProtocol.CreateEwkProtocol( ProtocolEnum.Res_Game_Change_Game_Mode, dic_ ) ); //ewk_ ); //IEwkProtocol ewkp = ProtocolUtility.DeserializeForProtobuf<EwkProtocol>( bytes ); // 비 generic collection은 직렬화안됨. //IEwkProtocol gewk = EwkProtocolFactory.CreateEwkProtocol<Hashtable>( ProtocolEnum.Avatar_Direction_Left, htable_ ); //IEwkProtocol gewk = EwkProtoFactory.CreateEwkProtocol<IList<string>>( ProtocolEnum.Ready, list_ ); IEwkProtocol gewk = EwkProtoFactory.CreateIEwkProtocol <QuizInfo>(ProtocolEnum.QuizInfo, quiz_info); //IEwkProtocol gewk = EwkProtoFactory.CreateEwkProtocol<IList<string>>( ProtocolEnum.Avatar_Direction_Left, list_ ); //IEwkProtocol ewk = EwkProtoFactory.CreateEwkProtocol( ProtocolEnum.Avatar_Direction_Left ); byte[] bytes = gewk.GetBytes; gewk = EwkProtoSerilazer.DeserializeForProtobuf(bytes); //EwkProtocol<QuizInfo> gewkp = gewk as EwkProtocol<QuizInfo>; //QuizInfo gewkpp = gewkp.Data; QuizInfo gewkpp = gewk.GetData <QuizInfo>(); //QuizInfo gewkpp = EwkProtoSerilazer.DeserializeForData<QuizInfo>( bytes ); //QuizInfo quiz_info = QuizInfo.CreateUserInfo(null, null, 100, 10); //Person p = new Person(); ////p.Protocol_Enum = ProtocolEnum.QuizInfo; //byte[] bytes = ProtocolUtility.SerializeForProtobuf<Person>(p); //EwkProtocol ewk = ProtocolUtility.DeserializeForProtobuf<EwkProtocol>(bytes); ////quiz_info = BinarySerializationExtension.DeserializeForProtobuf<QuizInfo>(bytes); //p = ProtocolUtility.DeserializeForProtobuf<Person>(bytes); }