/// <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"); }
/// <summary> /// ヒントボタン押下 /// </summary> public void ClickedHintButton() { ChangeQuizMode(QuizMode.Hint); SetResultCanvas(); // TODO: 一旦決め打ち UtageUtil.GetNazotokiAdvEngineController().JumpScenario("Test4"); }
/// <summary> /// クリック時 /// </summary> public void Clicked() { var configController = GameObject.Find("Config").GetComponent <ConfigDialogController>(); switch (_configSettingType) { case ConfigSettingType.Bgm: UtageUtil.GetNazotokiAdvEngineController().SetBgmVolume(_settingValue); break; case ConfigSettingType.Se: UtageUtil.GetNazotokiAdvEngineController().SetSeVolume(_settingValue); break; case ConfigSettingType.Voice: UtageUtil.GetNazotokiAdvEngineController().SetVoiceVolume(_settingValue); break; case ConfigSettingType.MessageSpeed: UtageUtil.GetNazotokiAdvEngineController().SetMessageSpeed(_settingValue); break; default: break; } configController.InitIsSetObjectsPosition(); }
/// <summary> /// アイテムを使用する /// </summary> /// <param name="itemId"></param> public void UseItem(string itemId) { _quizController.QuestionContorller.ReleaseQuestionObstacles(itemId); _currentGetItemList.Remove(itemId); UtageUtil.ChangeNazotokiAdvUiStatus(UiStatus.Default); }
/// <summary> /// 設定値のカーソル位置を初期化 /// </summary> public void InitIsSetObjectsPosition() { var engine = UtageUtil.GetNazotokiAdvEngine(); this.SetIsSetObjectPosition(ConfigSettingType.Bgm, engine.Config.BgmVolume); this.SetIsSetObjectPosition(ConfigSettingType.Se, engine.Config.SeVolume); this.SetIsSetObjectPosition(ConfigSettingType.Voice, engine.Config.VoiceVolume); this.SetIsSetObjectPosition(ConfigSettingType.MessageSpeed, engine.Config.MessageSpeed); }
/// <summary> /// アイテムを装備する /// </summary> /// <param name="itemId"></param> public void EquipItem(string itemId) { var itemInfo = ItemInfoList.Where(x => x.Id == itemId).FirstOrDefault(); var equipImage = _searchController.SearchEquipItemImage.GetComponent <Image>(); equipImage.sprite = itemInfo.SpThm; UtageUtil.ChangeNazotokiAdvUiStatus(UiStatus.Default); }
/// <summary> /// インベントリアイテムがクリックされた時 /// </summary> public void Clicked() { // クリックされたアイテムのIDをItemDetailダイアログに渡す // TODO: 最適化したい Scene scene = SceneManager.GetSceneByName("Manager"); ItemDetailDialogController itemDetailDialogController = null; foreach (var rootGameObject in scene.GetRootGameObjects()) { var ui = rootGameObject.transform.Find("UI"); if (ui == null) { continue; } var itemDetail = ui.transform.Find("ItemDetail"); itemDetailDialogController = itemDetail.GetComponent <ItemDetailDialogController>(); break; } itemDetailDialogController.DisplayItemId = _itemId; // ステータス変更 UtageUtil.ChangeNazotokiAdvUiStatus(AdvUiManager.UiStatus.ItemDetail); }
/// <summary> /// シナリオを開始する /// </summary> /// <param name="msg">表示するメッセージ</param> protected void StartSenario(string scenarioLabel, Action complete) { GameUtil.GetSearchController().SetSearchCanvasesEnabled(false); UtageUtil.GetNazotokiAdvEngineController().JumpScenario(scenarioLabel, complete); }
/// <summary> /// Update /// </summary> void Update() { _animTime += Time.deltaTime; // TODO: 最適化したい switch (_currentQuizMode) { case QuizMode.Question: break; case QuizMode.Result: if (_animTime > 3.0f) { if (_isCorrectQuiz) { ChangeQuizMode(QuizMode.GetItem); } else { ChangeQuizMode(QuizMode.Question); } } break; case QuizMode.GetItem: if (_animTime > 3.0f) { ChangeQuizMode(QuizMode.Scenario); _currentSenarioLabel = "Test6"; UtageUtil.GetNazotokiAdvEngineController().JumpScenario(_currentSenarioLabel); } break; case QuizMode.Hint: if (!UtageUtil.GetNazotokiAdvEngineController().IsPlayingScenario) { ChangeQuizMode(QuizMode.Question); } break; case QuizMode.Scenario: if (!UtageUtil.GetNazotokiAdvEngineController().IsPlayingScenario) { if (_isCorrectQuiz) { ChangeQuizMode(QuizMode.End); } else { ChangeQuizMode(QuizMode.Question); } } break; case QuizMode.End: var gameController = GameUtil.GetGameSceneController(); gameController.GetItem(_currentQuizInfo.GetItemId); gameController.CompleteHouseCount++; GameUtil.GetMapController().ReleaseHouseButton(gameController.CompleteHouseCount); gameController.ChangeGameMode(GameMode.Map); break; default: break; } }
/// <summary> /// インベントリボタン押下 /// </summary> public void ClickedInventoryButton() { UtageUtil.InitGetNazotokiAdvUi(); UtageUtil.ChangeNazotokiAdvUiStatus(UiStatus.Inventory); }
/// <summary> /// メニューボタン押下 /// </summary> public void ClickedMenuButton() { UtageUtil.InitGetNazotokiAdvUi(); UtageUtil.ChangeNazotokiAdvUiStatus(UiStatus.Menu); }
/// <summary> /// コンフィグボタン押下 /// </summary> public void ClickedConfigButton() { UtageUtil.ChangeNazotokiAdvUiStatus(AdvUiManager.UiStatus.Config); }
/// <summary> /// Start /// </summary> void Start() { UtageUtil.InitGetNazotokiAdvUi(); }
/// <summary> /// Start /// </summary> void Start() { // よく使用するため、コントローラの参照をあらかじめ取得しておく _nazotokiAdvEngineController = UtageUtil.GetNazotokiAdvEngineController(); _searchController = SearchGroup.GetComponent <SearchController>(); _mapController = _mapGroup.GetComponent <MapController>(); _quizController = _quizGroup.GetComponent <QuizController>(); // 初期化 _currentGetItemList = new List <string>(); _completeHouseCount = 1; // TODO: 外部ファイルから読み込み _itemInfoList = new List <ItemInfo>(); _quizInfoList = new List <QuizInfo>(); _stageInfoList = new List <StageInfo>(); _houseInfoList = new List <HouseInfo>(); // アイテム情報を読み込む var item1 = new ItemInfo(); item1.Id = "item_sample_1"; item1.Type = ItemType.Equipment; item1.Name = "ほげ"; item1.Description = "アイテム説明1"; item1.ThmFilePath = "Utage/Dialog/Inventory/ItemThumbnail/thm_sample_001"; item1.OrgFilePath = "Utage/Dialog/ItemDetail/ItemOrg/org_sample_001"; item1.SpThm = Resources.Load <Sprite>(item1.ThmFilePath); item1.SpOrg = Resources.Load <Sprite>(item1.OrgFilePath); ItemInfoList.Add(item1); var item2 = new ItemInfo(); item2.Id = "item_sample_2"; item2.Type = ItemType.Equipment; item2.Name = "ふが"; item2.Description = "アイテム説明2"; item2.ThmFilePath = "Utage/Dialog/Inventory/ItemThumbnail/thm_sample_002"; item2.OrgFilePath = "Utage/Dialog/ItemDetail/ItemOrg/org_sample_002"; item2.SpThm = Resources.Load <Sprite>(item2.ThmFilePath); item2.SpOrg = Resources.Load <Sprite>(item2.OrgFilePath); ItemInfoList.Add(item2); var item3 = new ItemInfo(); item3.Id = "item_sample_3"; item3.Type = ItemType.UseRooms; item3.Name = "ハゲ"; item3.Description = "アイテム説明3"; item3.ThmFilePath = "Utage/Dialog/Inventory/ItemThumbnail/thm_sample_003"; item3.OrgFilePath = "Utage/Dialog/ItemDetail/ItemOrg/org_sample_003"; item3.SpThm = Resources.Load <Sprite>(item3.ThmFilePath); item3.SpOrg = Resources.Load <Sprite>(item3.OrgFilePath); ItemInfoList.Add(item3); var item4 = new ItemInfo(); item4.Id = "item_sample_4"; item4.Type = ItemType.UseBossRoom; item4.Name = "手紙"; item4.Description = "直接届けられない想いを伝えるために……"; item4.ThmFilePath = "Utage/Dialog/Inventory/ItemThumbnail/thm_sample_004"; item4.OrgFilePath = "Utage/Dialog/ItemDetail/ItemOrg/org_sample_004"; item4.SpThm = Resources.Load <Sprite>(item4.ThmFilePath); item4.SpOrg = Resources.Load <Sprite>(item4.OrgFilePath); ItemInfoList.Add(item4); CurrentGetItemList.Add(item1.Id); CurrentGetItemList.Add(item2.Id); var quizInfo1 = new QuizInfo() { Id = "quiz_sample_1", CorrectAnswer = "興味", GetItemId = "item_sample_4", BeforeScenarioLabel = "Test1", EndScenarioLabel = "Test2", HintScenarioLabelList = new List <string>(), QuestionObjectFilePath = "Game/Prefab/Quiz/Question/SampleQuestion" }; _quizInfoList.Add(quizInfo1); var quizInfo2 = new QuizInfo() { Id = "quiz_sample_2", CorrectAnswer = "兵", GetItemId = "item_sample_4", BeforeScenarioLabel = "Test3", EndScenarioLabel = "Test4", HintScenarioLabelList = new List <string>(), QuestionObjectFilePath = "Game/Prefab/Quiz/Question/Sample2Question" }; _quizInfoList.Add(quizInfo2); var houseInfo1 = new HouseInfo() { Id = "house_sample_1", BeforeScenarioLabel = "Test1", EndScenarioLabel = "Test2", QuizId = "quiz_sample_1", HouseObjectFilePath = "Game/Prefab/Search/House/SampleHouse" }; _houseInfoList.Add(houseInfo1); var houseInfo2 = new HouseInfo() { Id = "house_sample_2", BeforeScenarioLabel = "Test4", EndScenarioLabel = "Test3", QuizId = "quiz_sample_2", HouseObjectFilePath = "Game/Prefab/Search/House/Sample2House" }; _houseInfoList.Add(houseInfo2); var stageInfo1 = new StageInfo() { Id = "stage_sample_1", StageObjectFilePath = "Game/Prefab/Map/Stage/SampleStage", EpilogueScenarioLabel = "Test1", PrologueScenarioLabel = "プロローグ" }; _stageInfoList.Add(stageInfo1); _currentStageInfo = stageInfo1; // 最初はシナリオシーン _currentScenarioLabel = stageInfo1.PrologueScenarioLabel; ChangeGameMode(GameMode.Senario); }