// Update is called once per frame void Update() { bool bInit = false; if (m_eStepPre != m_eStep) { m_eStepPre = m_eStep; bInit = true; } switch (m_eStep) { case STEP.IDLE: if (bInit) { if (m_buttonBaseWait != null) { m_buttonBaseWait.TriggerClear(); } if (m_buttonBaseClose != null) { m_buttonBaseClose.TriggerClear(); } } if (m_buttonBaseClose.ButtonPushed) { m_eStep = STEP.END; } else if (m_buttonBaseWait != null && m_buttonBaseWait.ButtonPushed) { m_eStep = STEP.CHECK_OJISAN; } else { } break; case STEP.CHECK_OJISAN: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); m_ojisanCheck.Initialize("この動物を\n待機室へ\n移動させます。"); } if (m_ojisanCheck.IsYes()) { CtrlFieldItem fielditem = GameMain.ParkRoot.GetFieldItem(m_dataMonster.item_serial); fielditem.RemoveMonster(m_dataMonster.monster_serial); GameMain.dbMonster.Update(m_dataMonster.monster_serial, 0); GameMain.ListRefresh = true; m_bIsEnd = true; GameMain.Instance.HeaderRefresh(); Destroy(m_ojisanCheck.gameObject); // これ、別のところでもやってます List <DataMonster> monster_list = GameMain.dbMonster.Select(" item_serial = " + fielditem.m_dataItem.item_serial.ToString()); int iUseCost = 0; foreach (DataMonster monster in monster_list) { DataMonsterMaster data_master = GameMain.dbMonsterMaster.Select(monster.monster_id); iUseCost += data_master.cost; } CsvItemDetailData detail_data = DataManager.GetItemDetail(fielditem.m_dataItem.item_id, fielditem.m_dataItem.level); GameMain.Instance.m_iCostMax = detail_data.cost; GameMain.Instance.m_iCostNow = iUseCost; GameMain.Instance.m_iCostNokori = detail_data.cost - iUseCost; m_eStep = STEP.END; } else if (m_ojisanCheck.IsNo()) { Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.IDLE; } else { } break; case STEP.END: if (bInit) { m_bIsEnd = true; } break; default: break; } }
// Update is called once per frame void Update() { bool bInit = false; if (m_eStepPre != m_eStep) { m_eStepPre = m_eStep; bInit = true; } switch (m_eStep) { case STEP.IDLE: if (bInit) { m_buttonBase.TriggerClear(); } if (m_buttonBase.ButtonPushed) { m_buttonBase.TriggerClear(); //Debug.Log (m_ItemMaster.category); if (m_bAbleUse) { switch ((Define.Item.Category)m_ItemMaster.category) { case Define.Item.Category.EXPAND: m_eStep = STEP.EXPAND_CHECK; break; case Define.Item.Category.TICKET: m_eStep = STEP.TICKET_CHECK; break; case Define.Item.Category.GOLD: m_eStep = STEP.GOLD_CHECK; break; default: GameMain.Instance.PreSettingItemId = 0; SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH); GameMain.Instance.SettingItem(m_iItemId, m_iItemSerial); GameMain.Instance.SetStatus(GameMain.STATUS.PARK); break; } } } break; case STEP.EXPAND_CHECK: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); m_ojisanCheck.Initialize("動物園を\n拡張します\n\nよろしいですか"); } if (m_ojisanCheck.IsYes()) { SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH); Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.EXPAND_BUY; } else if (m_ojisanCheck.IsNo()) { SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH); Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.IDLE; } else { } break; case STEP.EXPAND_BUY: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); m_ojisanCheck.Initialize("拡張いたしました!", true); GameMain.dbItem.Insert(m_ItemMaster, 0, 0, 0); DataItem.OpenNewItem(m_ItemMaster.item_id); GameObject prefab = PrefabManager.Instance.PrefabLoadInstance("prefab/PrefFieldItem"); DataManager.user.AddGold(-1 * m_ItemMaster.need_coin); for (int x = 0; x < DataManager.user.m_iWidth + Define.EXPAND_FIELD + 1; x++) { for (int y = 0; y < DataManager.user.m_iHeight + Define.EXPAND_FIELD + 1; y++) { if (DataManager.user.m_iWidth <= x || DataManager.user.m_iHeight <= y) { CtrlFieldItem script = null; script = GameMain.ParkRoot.GetFieldItem(x, y); if (script == null) { GameObject obj = PrefabManager.Instance.MakeObject(prefab, GameMain.ParkRoot.gameObject); obj.name = "fielditem_" + x.ToString() + "_" + y.ToString(); script = obj.GetComponent <CtrlFieldItem> (); GameMain.ParkRoot.AddFieldItem(script); } int iDummyItemId = 0; if (x == DataManager.user.m_iWidth + Define.EXPAND_FIELD || y == DataManager.user.m_iHeight + Define.EXPAND_FIELD) { iDummyItemId = -1; } script.Init(x, y, iDummyItemId); } } } DataManager.user.m_iWidth += Define.EXPAND_FIELD; DataManager.user.m_iHeight += Define.EXPAND_FIELD; PlayerPrefs.SetInt(Define.USER_WIDTH, DataManager.user.m_iWidth); PlayerPrefs.SetInt(Define.USER_HEIGHT, DataManager.user.m_iHeight); } if (m_ojisanCheck.IsYes()) { GameMain.ListRefresh = true; Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.IDLE; } break; case STEP.TICKET_CHECK: if (bInit) { string strBuyProductId = Define.GetProductId(m_ItemMaster.item_id, ref m_iTicketNum); PurchasesManager.buyItem(strBuyProductId); } if (PurchasesManager.Instance.IsPurchased()) { m_eStep = STEP.IDLE; if (PurchasesManager.Instance.Status == PurchasesManager.STATUS.SUCCESS) { m_eStep = STEP.TICKET_BUY; } } break; case STEP.TICKET_BUY: Debug.Log(string.Format("add ticket num:{0}", m_iTicketNum)); DataManager.user.AddTicket(m_iTicketNum); GameMain.Instance.HeaderRefresh(); m_eStep = STEP.IDLE; break; case STEP.GOLD_CHECK: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); m_ojisanCheck.Initialize(string.Format("チケットをゴールドに\n変換します\n\n{0}G→ {1}G\nよろしいですか", DataManager.user.m_iGold, DataManager.user.m_iGold + m_ItemMaster.add_coin)); } if (m_ojisanCheck.IsYes()) { SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH); Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.GOLD_BUY; } else if (m_ojisanCheck.IsNo()) { SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH); Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.IDLE; } else { } break; case STEP.GOLD_BUY: DataManager.user.AddTicket(-1 * m_ItemMaster.need_ticket); DataManager.user.AddGold(m_ItemMaster.add_coin); GameMain.Instance.HeaderRefresh(); m_eStep = STEP.IDLE; break; default: break; } return; }
// Update is called once per frame void Update() { bool bInit = false; if (m_eStepPre != m_eStep) { m_eStepPre = m_eStep; bInit = true; } switch (m_eStep) { case STEP.IDLE: if (bInit) { m_buttonBase.TriggerClear(); } if (m_buttonBase.ButtonPushed) { m_buttonBase.TriggerClear(); if (m_bAbleUse) { Debug.Log("clicked:BannerBase.Mode=" + BannerBase.Mode.ToString()); //SoundManager.Instance.PlaySE (SoundName.BUTTON_PUSH); switch (BannerBase.Mode) { case BannerBase.MODE.MONSTER_DETAIL: m_eStep = STEP.DETAIL; break; case BannerBase.MODE.MONSTER_SET_BUY: m_eStep = STEP.SET_BUY; break; case BannerBase.MODE.MONSTER_SET_MINE: m_eStep = STEP.SET_MINE; break; case BannerBase.MODE.MONSTER_SICK: m_eStep = STEP.SICK; break; default: break; } } } break; case STEP.DETAIL: if (bInit) { SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH); // この作り方はいただけませんねぇ・・・ GameObject obj = PrefabManager.Instance.MakeObject("prefab/PrefMonsterDetail", gameObject.transform.parent.parent.parent.parent.gameObject); m_monsterDetail = obj.GetComponent <CtrlMonsterDetail> (); m_monsterDetail.Initialize(m_dataMonster.monster_serial); } if (m_monsterDetail.IsEnd()) { SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH); Destroy(m_monsterDetail.gameObject); m_monsterDetail = null; m_eStep = STEP.IDLE; } break; case STEP.SET_BUY: if (bInit) { SoundManager.Instance.PlaySE(SoundName.SET_ANIMAL); CsvMonsterData monster_data = DataManager.GetMonster(m_dataMonsterMaster.monster_id); if (0 < monster_data.coin) { DataManager.user.AddGold(-1 * monster_data.coin); } else if (0 < monster_data.ticket) { DataManager.user.AddTicket(-1 * monster_data.ticket); } else { ; // エラーちゃう? } // 0番のページに飛ばす DataMonster insertMonster = GameMain.dbMonster.Insert(m_dataMonsterMaster.monster_id, GameMain.Instance.m_iSettingItemSerial); m_tabParent.TriggerOn(0); CtrlFieldItem fielditem = GameMain.ParkRoot.GetFieldItem(GameMain.Instance.m_iSettingItemSerial); GameObject objIcon = PrefabManager.Instance.MakeObject("prefab/PrefIcon", fielditem.gameObject); CtrlIconRoot iconRoot = objIcon.GetComponent <CtrlIconRoot> (); iconRoot.Initialize(insertMonster, fielditem); fielditem.Add(iconRoot); // 仕事の確認 DataWork.WorkCheck(); GameMain.Instance.HeaderRefresh(); if (0 < GameMain.Instance.TutorialMonster) { TutorialManager.Instance.Next(); GameMain.Instance.TutorialMonster = 0; } } break; case STEP.SET_MINE: if (bInit) { SoundManager.Instance.PlaySE(SoundName.SET_ANIMAL); Dictionary <string, string> dict = new Dictionary <string, string> (); dict.Add("item_serial", GameMain.Instance.m_iSettingItemSerial.ToString()); dict.Add("collect_time", "\"" + TimeManager.StrNow() + "\""); GameMain.dbMonster.Update(m_dataMonster.monster_serial, dict); //GameMain.dbMonster.Update (m_dataMonster.monster_serial, GameMain.Instance.m_iSettingItemSerial); m_tabParent.TriggerOn(0); DataMonster insertMonster = GameMain.dbMonster.Select(m_dataMonster.monster_serial); CtrlFieldItem fielditem = GameMain.ParkRoot.GetFieldItem(GameMain.Instance.m_iSettingItemSerial); GameObject objIcon = PrefabManager.Instance.MakeObject("prefab/PrefIcon", fielditem.gameObject); CtrlIconRoot iconRoot = objIcon.GetComponent <CtrlIconRoot> (); iconRoot.Initialize(insertMonster, fielditem); fielditem.Add(iconRoot); // 仕事の確認 DataWork.WorkCheck(); GameMain.Instance.HeaderRefresh(); } break; case STEP.SICK: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject); CsvMonsterData monster = DataManager.GetMonster(m_dataMonster.monster_id); int iCost = monster.revenew_coin * (int)(600.0f / (float)monster.revenew_interval); bool bYesOnly = false; string strText = string.Format("こちらの動物を\n治療しますか\n\n治療費:{0}G\n\n{1}G → [FFD900]{2}[-]G", iCost, DataManager.user.m_iGold, DataManager.user.m_iGold - iCost); if (DataManager.user.m_iGold < iCost) { bYesOnly = true; strText = string.Format("こちらの動物を\n治療しますか\n治療費:{0}G\n\n[FFD900]GOLDが足りません[-]", iCost); } m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); m_ojisanCheck.Initialize(strText, bYesOnly); } if (m_ojisanCheck.IsYes()) { SoundManager.Instance.PlaySE("se_cure"); CsvMonsterData monster = DataManager.GetMonster(m_dataMonster.monster_id); int iCost = monster.revenew_coin * (int)(600.0f / (float)monster.revenew_interval); DataManager.user.AddGold(-1 * iCost); GameMain.ListRefresh = true; Destroy(m_ojisanCheck.gameObject); Dictionary <string, string> dict = new Dictionary <string, string> (); int iConditionFine = (int)Define.Monster.CONDITION.FINE; dict.Add("condition", iConditionFine.ToString()); dict.Add("clean_time", string.Format("\"{0}\" ", TimeManager.StrGetTime())); Debug.Log(TimeManager.StrGetTime()); GameMain.dbMonster.Update(m_dataMonster.monster_serial, dict); m_eStep = STEP.IDLE; } else if (m_ojisanCheck.IsNo()) { SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH); Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.IDLE; } else { } break; case STEP.SET_CAGE: break; case STEP.MAX: default: break; } }
// Update is called once per frame void Update() { string strPrefab = "prefab/PrefItemDetailDisp"; bool bInit = false; if (m_eStepPre != m_eStep) { m_eStepPre = m_eStep; bInit = true; } switch (m_eStep) { case STEP.IDLE: if (bInit) { m_buttonBase.TriggerClear(); } if (m_buttonBase.ButtonPushed) { m_buttonBase.TriggerClear(); Debug.Log("clicked:BannerBase.Mode=" + BannerBase.Mode.ToString()); if (m_bAbleUse) { switch (BannerBase.Mode) { case BannerBase.MODE.STAFF_SET_BUY: m_eStep = STEP.SETTING; break; case BannerBase.MODE.STAFF_SET_MINE: m_eStep = STEP.SETTING; break; case BannerBase.MODE.STAFF_BACKYARD_CHECK: m_eStep = STEP.BACKYARD_CHECK; break; default: break; } } } break; case STEP.SETTING: if (bInit) { // この作り方はいただけませんねぇ・・・ GameObject obj = PrefabManager.Instance.MakeObject("prefab/PrefStaffSetting", gameObject); m_staffSetting = obj.GetComponent <CtrlStaffSetting> (); Debug.Log(m_staffSetting); // ここで取得するっていうのもなんか良くないっすね DataItem officeData = GameMain.dbItem.Select(GameMain.Instance.m_iSettingItemSerial); Debug.Log(officeData); Debug.Log(m_dataStaff.staff_id); Debug.Log(m_dataStaff.staff_serial); Debug.Log(m_staffSetting); m_staffSetting.Initialize(officeData, m_dataStaff.staff_id, m_dataStaff.staff_serial); } if (m_staffSetting.IsEnd()) { m_staffSetting.Close(); Destroy(m_staffSetting.gameObject); m_staffSetting = null; m_eStep = STEP.IDLE; } break; case STEP.BACKYARD_CHECK: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); m_ojisanCheck.Initialize("こちらのスタッフを\n待機室へ\n移動させます。"); } if (m_ojisanCheck.IsYes()) { GameMain.ListRefresh = true; m_eStep = STEP.BACKYARD; } else if (m_ojisanCheck.IsNo()) { Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.IDLE; } else { } break; case STEP.BACKYARD: CtrlFieldItem field_item = GameMain.ParkRoot.GetFieldItem(m_dataStaff.item_serial); field_item.RemoveStaff(m_dataStaff.staff_serial); Dictionary <string, string> dict = new Dictionary <string, string> (); dict.Add("office_serial", 0.ToString ()); dict.Add("item_serial", 0.ToString ()); //dict.Add ("setting_time", "\"" + strNow + "\""); GameMain.dbStaff.Update(m_dataStaff.staff_serial, dict); CsvStaffData staff_data = DataManager.GetStaff(m_dataStaff.staff_id); GameMain.Instance.m_iCostNokori += staff_data.cost; GameMain.ListRefresh = true; m_eStep = STEP.IDLE; // 仕事の確認 DataWork.WorkCheck(); GameMain.Instance.HeaderRefresh(); // バックヤードに戻す場合はこっちでおじさんをけすd Destroy(m_ojisanCheck.gameObject); break; default: break; } }
// Update is called once per frame void Update() { bool bInit = false; if (m_eStepPre != m_eStep) { m_eStepPre = m_eStep; bInit = true; } switch (m_eStep) { case STEP.DATAMANAGER_SETUP: if (bInit) { /* * GameObject pref = PrefabManager.Instance.PrefabLoadInstance ("test"); * paramtest script = pref.GetComponent<paramtest> (); * Debug.Log (script.list.Count); * script.list.Add (new DataItem ()); */ } if (SpriteManager.Instance.IsIdle()) { m_goRoot.SetActive(true); m_btnStart.gameObject.SetActive(false); m_eStep = STEP.SOUND_LOAD; } if (m_csLoading != null) { m_csLoading.ViewPercent(0.0f); } break; case STEP.SOUND_LOAD: if (bInit) { foreach (MasterAudioCSV data in DataManager.master_audio_list) { if (data.audio_type != 1) { SoundManager.Instance.AddLoadFile(data.filename); } } } if (m_csLoading != null) { m_csLoading.ViewPercent(0.0f); } if (SoundManager.Instance.IsIdle()) { m_btnStart.gameObject.SetActive(true); m_eStep = STEP.IDLE; if (ReviewManager.Instance.IsReadyReview()) { m_eStep = STEP.REVIEW; } } break; case STEP.REVIEW: if (bInit) { GameObject obj = PrefabManager.Instance.MakeObject("prefab/CtrlReviewWindow", m_goRoot.transform.parent.gameObject); m_reviewWindow = obj.GetComponent <CtrlReviewWindow> (); m_reviewWindow.Initialize(); m_goRoot.SetActive(false); } if (m_reviewWindow.IsEnd()) { m_goRoot.SetActive(true); Destroy(m_reviewWindow.gameObject);; m_eStep = STEP.IDLE; } break; case STEP.IDLE: if (bInit) { m_btnStart.TriggerClear(); m_btnBackup.TriggerClear(); } if (m_btnStart.ButtonPushed) { m_eStep = STEP.DB_SETUP; SoundManager.Instance.PlaySE("se_cleanup"); } else if (m_btnBackup.ButtonPushed) { string backupDB = System.IO.Path.Combine(Application.persistentDataPath, Define.DB_NAME_DOUBTSUEN_BK); if (System.IO.File.Exists(backupDB) == false) { m_eStep = STEP.DB_BACKUP_NOEXIST; } else { m_eStep = STEP.DB_BACKUP_CHECK; } } else { } break; case STEP.DB_SETUP: if (bInit) { m_dbItem = new DBItem(Define.DB_TABLE_ASYNC_ITEM); m_dbItemMaster = new DBItemMaster(Define.DB_TABLE_ASYNC_ITEM_MASTER); m_dbWork = new DBWork(Define.DB_TABLE_ASYNC_WORK); m_dbMonster = new DBMonster(Define.DB_TABLE_ASYNC_MONSTER); m_dbMonsterMaster = new DBMonsterMaster(Define.DB_TABLE_ASYNC_MONSTER_MASTER); m_dbKvs = new DBKvs(Define.DB_TABLE_ASYNC_KVS); /* * m_dbItem.Open (Define.DB_NAME_DOUBTSUEN, Define.DB_FILE_DIRECTORY, ""); * m_dbItemMaster.Open (Define.DB_NAME_DOUBTSUEN, Define.DB_FILE_DIRECTORY, ""); * m_dbWork.Open (Define.DB_NAME_DOUBTSUEN, Define.DB_FILE_DIRECTORY, ""); * m_dbMonster.Open (Define.DB_NAME_DOUBTSUEN, Define.DB_FILE_DIRECTORY, ""); * m_dbMonsterMaster.Open (Define.DB_NAME_DOUBTSUEN, Define.DB_FILE_DIRECTORY, ""); * m_tkKvsOpen = m_dbKvs.Open (Define.DB_NAME_DOUBTSUEN, Define.DB_FILE_DIRECTORY, ""); // DEFINE.DB_PASSWORD */ } if (true) { //if (m_tkKvsOpen.Completed) { if (m_dbKvs.ReadInt(Define.USER_SYOJIKIN) == 0) { m_dbKvs.WriteInt(Define.USER_SYOJIKIN, 1000); } List <DataItem> data_item_list = m_dbItem.SelectAll(); // 最初しか通らない if (data_item_list.Count == 0) { Debug.LogError("here"); m_dbKvs.WriteInt(Define.USER_SYAKKIN, 300000000); var skitMasterTable = new MasterTableMapChip(); skitMasterTable.Load(); var csvItem = new CsvItem(); csvItem.Load(); foreach (MapChipCSV csvMapChip in skitMasterTable.All) { DataItem data = new DataItem(csvMapChip, csvItem); m_dbItem.Replace(data); } } List <DataWork> data_work_list = m_dbWork.SelectAll(); if (data_work_list.Count == 0) { var csvWork = new CsvWork(); csvWork.Load(); foreach (CsvWorkData csv_work_data in csvWork.All) { DataWork data = new DataWork(csv_work_data); // 最初に出現していいのはappear_work_id== 0とlevel<=1のものだけ if (data.appear_work_id == 0 && data.level <= 1) { data.status = 1; } m_dbWork.Replace(data); } } List <DataMonster> data_monster_list = m_dbMonster.SelectAll(); //Debug.LogError( string.Format( "data_monster_list.Count:{0}" , data_monster_list.Count )); if (data_monster_list.Count == 0) { DataMonster monster = new DataMonster(); monster.monster_serial = 1; monster.monster_id = 1; monster.item_serial = 12; monster.condition = (int)Define.Monster.CONDITION.FINE; monster.collect_time = TimeManager.StrNow(); string strHungry = TimeManager.StrGetTime(-1 * 60 * 30); monster.meal_time = strHungry; monster.clean_time = strHungry; m_dbMonster.Replace(monster); } List <DataMonsterMaster> data_monster_master_list = m_dbMonsterMaster.SelectAll(); if (data_monster_master_list.Count == 0) { var csvMonsterMaster = new CsvMonster(); csvMonsterMaster.Load(); foreach (CsvMonsterData csv_monster_master_data in csvMonsterMaster.All) { m_dbMonsterMaster.Replace(csv_monster_master_data); } } List <DataItemMaster> data_item_master = m_dbItemMaster.SelectAll(); //Debug.LogError (string.Format ("count:{0}", data_item_master.Count)); if (data_item_master.Count == 0) { var csvItem = new CsvItem(); csvItem.Load(); foreach (CsvItemData csv_item_data in csvItem.All) { DataItemMaster data = new DataItemMaster(csv_item_data); if (data.open_item_id == 0) { data.status = 1; } m_dbItemMaster.Replace(data); } } m_eStep = STEP.INPUT_WAIT; } else { //Debug.Log ("wait"); } break; case STEP.INPUT_WAIT: if (bInit) { m_btnStart.TriggerClear(); } if (true) { // とりあえず全部調べる List <DataWork> cleared_work_list = m_dbWork.Select(string.Format(" status = {0} ", (int)Define.Work.STATUS.CLEARD)); foreach (DataWork work in cleared_work_list) { List <DataMonsterMaster> list_monster = m_dbMonsterMaster.Select(string.Format(" status = 0 and open_work_id = {0} ", work.work_id)); foreach (DataMonsterMaster data_monster_master in list_monster) { Dictionary <string, string> monster_master_dict = new Dictionary <string, string> (); monster_master_dict.Add("status", "1"); m_dbMonsterMaster.Update(data_monster_master.monster_id, monster_master_dict); } } m_btnStart.TriggerClear(); Application.LoadLevel("park_main"); } break; case STEP.DB_BACKUP_NOEXIST: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", m_posDisplay); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); m_ojisanCheck.Initialize("バックアップファイルが\n存在しません", true); } if (m_ojisanCheck.IsYes()) { Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.IDLE; } break; case STEP.DB_BACKUP_CHECK: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", m_posDisplay); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); m_ojisanCheck.Initialize("自動保存されたデータ\nを利用して\nバックアップを行います\n\nよろしいですか"); } if (m_ojisanCheck.IsYes()) { //SoundManager.Instance.PlaySE (SoundName.BUTTON_PUSH); Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.DB_BACKUP; } else if (m_ojisanCheck.IsNo()) { //SoundManager.Instance.PlaySE (SoundName.BUTTON_PUSH); Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.IDLE; } else { } break; case STEP.DB_BACKUP: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", m_posDisplay); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); m_ojisanCheck.Initialize("完了しました\nゲームをスタートしてください", true); string sourceDB = System.IO.Path.Combine(Application.persistentDataPath, Define.DB_NAME_DOUBTSUEN); string dummyDB = System.IO.Path.Combine(Application.persistentDataPath, Define.DB_NAME_DOUBTSUEN + "." + TimeManager.StrGetTime()); string backupDB = System.IO.Path.Combine(Application.persistentDataPath, Define.DB_NAME_DOUBTSUEN_BK); string backup2DB = System.IO.Path.Combine(Application.persistentDataPath, Define.DB_NAME_DOUBTSUEN_BK2); if (System.IO.File.Exists(sourceDB)) { System.IO.File.Copy(sourceDB, dummyDB, true); } if (System.IO.File.Exists(backupDB)) { System.IO.File.Copy(backupDB, sourceDB, true); } } if (m_ojisanCheck.IsYes()) { Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.IDLE; } break; default: break; } if (m_btnTutorialReset.ButtonPushed) { PlayerPrefs.DeleteAll(); string full_path = System.IO.Path.Combine(Application.persistentDataPath, Define.DB_NAME_DOUBTSUEN); System.IO.File.Delete(full_path); m_btnTutorialReset.TriggerClear(); } if (m_btnCacheClear.ButtonPushed) { Caching.CleanCache(); m_btnCacheClear.TriggerClear(); } }
// Update is called once per frame void Update() { bool bInit = false; if (m_eStepPre != m_eStep) { m_eStepPre = m_eStep; bInit = true; } switch (m_eStep) { case STEP.IDLE: if (bInit) { m_buttonBase.TriggerClear(); } if (m_buttonBase.ButtonPushed) { m_buttonBase.TriggerClear(); if (m_dataWork.status == 1) { if (0 < m_dataWork.mission_monster) { m_eStep = STEP.MONSTER_BUY_CHECK; } else if (0 < m_dataWork.mission_item) { DataItemMaster item_master = GameMain.dbItemMaster.Select(m_dataWork.mission_item); if (item_master.status == (int)Define.Item.Status.NONE) { m_eStep = STEP.ITEM_HINT; } else { m_eStep = STEP.ITEM_MOVE; } } else if (0 < m_dataWork.mission_staff) { m_eStep = STEP.STAFF_MOVE; } else { } } } break; case STEP.MONSTER_BUY_CHECK: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); CsvMonsterData monster_data = DataManager.GetMonster(m_dataWork.mission_monster); string strDisp = ""; if (monster_data.coin <= DataManager.user.m_iGold) { strDisp = string.Format("本当に購入しますか?\n({0}G)\n\n{1}G→[FFD900]{2}G[-]", monster_data.coin, DataManager.user.m_iGold, DataManager.user.m_iGold - monster_data.coin); //strDisp = string.Format("こちらの動物を\n購入しますか({0}G)\n\n{1}G→{2}G" , monster_data.coin , DataManager.user.m_iGold , DataManager.user.m_iGold - monster_data.coin ); } else { strDisp = string.Format("こちらの動物を\n購入しますか\n\n購入には[FF0000]{0}G[-]必要です\n[FF0000]{1}G[-]不足しています", monster_data.coin, monster_data.coin - DataManager.user.m_iGold); m_ojisanCheck.YesOrNo.EnableButtonYes(false); } m_ojisanCheck.Initialize(strDisp); } if (m_ojisanCheck.IsYes()) { Destroy(m_ojisanCheck.gameObject); SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH); m_eStep = STEP.MONSTER_BUY; } else if (m_ojisanCheck.IsNo()) { Destroy(m_ojisanCheck.gameObject); SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH); m_eStep = STEP.IDLE; } else { } break; case STEP.MONSTER_BUY: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); string strDisp = "購入完了しました\n檻から設置を\n行ってください\n"; m_ojisanCheck.Initialize(strDisp, true); /* * Dictionary< string , string > dict = new Dictionary< string , string > (); * int iConditionFine = (int)Define.Monster.CONDITION.FINE; * dict.Add( "condition" , iConditionFine.ToString() ); */ GameMain.dbMonster.Insert(m_dataWork.mission_monster, 0); CsvMonsterData monster_data = DataManager.GetMonster(m_dataWork.mission_monster); DataManager.user.AddGold(monster_data.coin * -1); DataWork.WorkCheck(); } if (m_ojisanCheck.IsYes()) { Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.IDLE; GameMain.ListRefresh = true; } break; case STEP.ITEM_HINT: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); DataItemMaster item_mission = GameMain.dbItemMaster.Select(m_dataWork.mission_item); DataItemMaster item_open = GameMain.dbItemMaster.Select(item_mission.open_item_id); string strDisp = string.Format("HINT!\n\n{0}は\n[FF0000]{1}[-]を購入すると\n購入可能になります", item_mission.name, item_open.name); m_ojisanCheck.Initialize(strDisp, true); } if (m_ojisanCheck.IsYes()) { Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.IDLE; } break; case STEP.ITEM_MOVE: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); string strDisp = string.Format("購入ページに移動します\nよろしいですか?"); m_ojisanCheck.Initialize(strDisp); } if (m_ojisanCheck.IsYes()) { Destroy(m_ojisanCheck.gameObject); DataItemMaster item_mission = GameMain.dbItemMaster.Select(m_dataWork.mission_item); switch (item_mission.category) { case 1: default: GameMain.Instance.m_iMoveTab = 0; break; case 2: GameMain.Instance.m_iMoveTab = 1; break; case 3: GameMain.Instance.m_iMoveTab = 2; break; } GameMain.Instance.SetStatus(GameMain.STATUS.ITEM); //m_eStep = STEP.IDLE; } else if (m_ojisanCheck.IsNo()) { Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.IDLE; } else { } break; case STEP.STAFF_MOVE: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.parent.parent.gameObject); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); //string strDisp = string.Format("HINT!\n\nスタッフを雇う場合は\n檻を選択してから\n配置を行うことができます" ); string strDisp = string.Format("\n\nHINT!\n\nオフィス購入後、各施設の「配置」タブからスタッフを雇えるよ!\n\n"); m_ojisanCheck.Initialize(strDisp, true); } if (m_ojisanCheck.IsYes()) { Destroy(m_ojisanCheck.gameObject); m_eStep = STEP.IDLE; } break; break; case STEP.MAX: default: break; } }
// Update is called once per frame void Update() { bool bInit = false; if (m_eStepPre != m_eStep) { m_eStepPre = m_eStep; bInit = true; } switch (m_eStep) { case STEP.IDLE: if (bInit) { Debug.Log(DataManager.user.m_iGold); m_btnBuildup.TriggerClear(); } if (m_btnBuildup.ButtonPushed || GameMain.Instance.TutorialBuildup) { m_btnBuildup.TriggerClear(); SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH); // お金が足りるなら確認 if (m_dataNext.coin <= DataManager.user.m_iGold || GameMain.Instance.TutorialBuildup) { GameMain.Instance.TutorialBuildup = false; m_eStep = STEP.CHECK_BUILDUP; } else { m_eStep = STEP.GOLD_FUSOKU; } } break; case STEP.CHECK_BUILDUP: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.gameObject); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); string strDisp = ""; strDisp = string.Format("本当に増強しますか\n\n{0}G → [FFD900]{1}[-]G\n", DataManager.user.m_iGold, DataManager.user.m_iGold - m_dataNext.coin); m_ojisanCheck.Initialize(strDisp); } if (m_ojisanCheck.IsYes()) { Destroy(m_ojisanCheck.gameObject); SoundManager.Instance.PlaySE(SoundName.BUILDUP); m_eStep = STEP.BUILDUP; } else if (m_ojisanCheck.IsNo()) { Destroy(m_ojisanCheck.gameObject); SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH); m_eStep = STEP.IDLE; } else { } break; case STEP.GOLD_FUSOKU: if (bInit) { GameObject objOjisan = PrefabManager.Instance.MakeObject("prefab/PrefOjisanCheck", gameObject.transform.parent.parent.gameObject); m_ojisanCheck = objOjisan.GetComponent <CtrlOjisanCheck> (); string strDisp = ""; strDisp = string.Format("増強費用は\n[FFD900]{0}G[-]必要です\n\n[FFD900]{1}G[-]不足しています", m_dataNext.coin, m_dataNext.coin - DataManager.user.m_iGold); m_ojisanCheck.Initialize(strDisp, true); } if (m_ojisanCheck.IsYes()) { Destroy(m_ojisanCheck.gameObject); SoundManager.Instance.PlaySE(SoundName.BUTTON_PUSH); m_eStep = STEP.IDLE; } break; case STEP.BUILDUP: if (true) { // 増強費用 DataManager.user.AddGold(m_dataNext.coin * -1); // 経験値獲得 DataManager.user.AddExp(m_dataNext.get_exp); buildup(); } m_eStep = STEP.IDLE; break; case STEP.MAX: default: break; } }