public void LoadChoiceItem(AppContentChoice choice, AppContentChoiceItem choiceItem, Color colorTo) { LogUtil.Log("LoadChoiceItem:" + choice.code); SetChoiceParticleSystemColors(colorTo); LoadChoiceItem(choice, choiceItem); }
public void UpdateDisplayItemData() { LogUtil.Log("UIPanelModeTypeChoice:UpdateDisplayItemData"); UIColors.UpdateColors(); UIUtil.SetLabelValue(labelDisplayItemStatus, GetStatusItemProgress()); AppContentChoice choice = GetCurrentChoice(); if (choice != null) { string choiceTitle = "Loading..."; string choiceQuestion = "Loading..."; if (choice != null) { choiceTitle = "Question"; choiceQuestion = choice.display_name; } UIUtil.SetLabelValue(labelDisplayItemTitle, choiceTitle); UIUtil.SetLabelValue(labelDisplayItemQuestion, choiceQuestion); } }
public void UpdateResultItemData() { LogUtil.Log("UIPanelModeTypeChoice:UpdateResultItemData"); UIUtil.SetLabelValue(labelResultItemStatus, GetStatusItemProgress()); UIColors.UpdateColors(); AppContentChoice choice = GetCurrentChoice(); string typeValue = "CORRECT"; string codeValue = "FALSE"; if (isCorrect) //currentChoiceData.CheckChoices(true)) { { UIColors.UpdateColor(containerChoiceResultItem, UIColors.colorGreen); typeValue = "CORRECT!"; GameAudioController.PlaySoundPlayerActionGood(); choicesCorrect += 1; } else { UIColors.UpdateColor(containerChoiceResultItem, UIColors.colorRed); typeValue = "INCORRECT..."; GameAudioController.PlaySoundPlayerActionBad(); } foreach (AppContentChoiceItem choiceItem in choice.choices) { if (choiceItem != null) { if (choiceItem.IsTypeCorrect()) { codeValue = choiceItem.display; } } } if (choice != null) { string choiceResultType = typeValue; string choiceResultValue = codeValue; string choiceResultDescription = choice.description; string choiceResultDisplayName = choice.display_name; if (choice != null) { //choiceQuestion = choice.display_name + choice.code; } UIUtil.SetLabelValue(labelResultItemChoiceDisplayName, choiceResultDisplayName); UIUtil.SetLabelValue(labelResultItemChoiceDescription, choiceResultDescription); UIUtil.SetLabelValue(labelResultItemChoiceResultValue, choiceResultValue); UIUtil.SetLabelValue(labelResultItemChoiceResultType, choiceResultType); } }
public void LoadChoiceItem(AppContentChoice choice, AppContentChoiceItem choiceItem) { appContentChoice = choice; appContentChoiceItem = choiceItem; LoadChoice( appContentChoice.code, appContentChoice.type, appContentChoiceItem.IsTypeCorrect(), appContentChoiceItem.display, appContentChoiceItem.code, "barrel-1"); }
public void LoadChoice( string choiceCode, string choiceType, bool choiceItemIsCorrect, string choiceItemDisplay, string choiceItemCode, string choiceItemAssetCode) { choiceData = new GameObjectChoiceData(); choiceData.choiceCode = choiceCode; choiceData.choiceType = choiceType; choiceData.choiceItemIsCorrect = choiceItemIsCorrect; choiceData.choiceItemDisplay = choiceItemDisplay; choiceData.choiceItemCode = choiceItemCode; choiceData.choiceItemAssetCode = choiceItemAssetCode; appContentChoice = AppContentChoices.Instance.GetByCode(choiceCode); if (appContentChoice != null) { foreach (AppContentChoiceItem choiceItem in appContentChoice.choices) { if (choiceItem.code == choiceItemCode) { appContentChoiceItem = choiceItem; } } } //LogUtil.Log("LoadChoice:choiceCode:" + choiceCode); //LogUtil.Log("LoadChoice:choiceType:" + choiceType); //LogUtil.Log("LoadChoice:choiceItemIsCorrect:" + choiceItemIsCorrect); //LogUtil.Log("LoadChoice:choiceItemDisplay:" + choiceItemDisplay); LogUtil.Log("LoadChoice:choiceItemCode:" + choiceItemCode); //LogUtil.Log("LoadChoice:choiceItemAssetCode:" + choiceItemAssetCode); LoadAsset(choiceItemAssetCode); LogUtil.Log("LoadChoice:SetLabel:choiceData.choiceItemDisplay:" + choiceData.choiceItemDisplay); UIUtil.SetLabelValue(labelResponse, choiceData.choiceItemDisplay); UIUtil.SetLabelValue(labelResponseShadow, choiceData.choiceItemDisplay); //LogUtil.Log("LoadChoice:SetLabel:labelResponse:" + labelResponse.text); hasLoadedChoice = true; }
public void OnAppContentChoiceItemHandler(GameObjectChoiceData data) { CheckChoicesData(); isCorrect = data.choiceItemIsCorrect; AppContentChoiceData choiceData = new AppContentChoiceData(); choiceData.choiceCode = data.choiceCode; appContentChoice = AppContentChoices.Instance.GetByCode(data.choiceCode); appContentChoiceItem = null; if (appContentChoice != null) { foreach (AppContentChoiceItem choiceItem in appContentChoice.choices) { if (choiceItem.code == data.choiceItemCode) { appContentChoiceItem = choiceItem; } } } choiceData.choices.Add(appContentChoiceItem); choiceData.choiceData = ""; if (appContentChoicesData != null) { appContentChoicesData.SetChoice(choiceData); } currentChoiceData = choiceData; currentChoiceItem = appContentChoiceItem; SaveChoiceState(); ChangeState(AppModeTypeChoiceFlowState.AppModeTypeChoiceResultItem); }
public void LoadChoices(int total) { CheckChoices(); CheckChoicesData(); ListClear(listGridRoot); choices.Clear(); appContentChoicesData = new AppContentChoicesData(); List <AppContentChoice> choicesFilter = AppContentChoices.Instance.GetAll(); // Randomize choicesFilter.Shuffle(); int countChoices = choicesFilter.Count; LogUtil.Log("LoadChoices:countChoices:" + countChoices); // select total choices to try for (int i = 0; i < total; i++) { AppContentChoice choice = choicesFilter[i]; if (choice != null) { if (!choices.ContainsKey(choice.code)) { choices.Add(choice.code, choice); LogUtil.Log("LoadChoices:choice.code:" + choice.code); } } } LogUtil.Log("LoadChoices:choices.Count:" + choices.Count); }
public void loadDataChoiceItems() { LogUtil.Log("loadDataChoiceItems"); int i = 0; LogUtil.Log("loadDataChoiceItems:" + i); AppContentChoice choice = GetCurrentChoice(); if (choice != null) { float x = -60; foreach (AppContentChoiceItem choiceItem in choice.choices) { // Add to list string levelName = "choice" + choice.code + "-" + choiceItem.code + "-" + i; if (!listGridRoot.ContainsChild(levelName)) { GameObject item = NGUITools.AddChild(listGridRoot, prefabListItem); item.name = levelName; GameObjectChoice choiceObject = item.Get <GameObjectChoice>(); if (choiceObject != null) { choiceObject.LoadChoiceItem(choice, choiceItem, GetColor(i)); } } // Add to level string levelNameItem = "choice-item" + choice.code + "-" + choiceItem.code + "-" + i; if (!GameController.Instance.levelItemsContainerObject.ContainsChild(levelNameItem)) { GameObject itemLevel = NGUITools.AddChild(GameController.Instance.levelItemsContainerObject, prefabLevelItem); itemLevel.name = levelNameItem; GameObjectChoice choiceObjectLevel = itemLevel.Get <GameObjectChoice>(); if (choiceObjectLevel != null) { choiceObjectLevel.LoadChoiceItem(choice, choiceItem, GetColor(i)); GamePlayerIndicator indicator = GamePlayerIndicator.AddIndicator( itemLevel, GamePlayerIndicatorType.choice, GetColor(i)); if (indicator != null) { indicator.SetIndicatorColorEffects(GetColor(i)); } } choiceObjectLevel.transform.position = Vector3.zero.WithX(x += (UnityEngine.Random.Range(20, 60) * 1)).WithZ(UnityEngine.Random.Range(-30, 30)); } i++; } } }