public void Copy(DataItemMaster _data) { item_id = _data.item_id; status = 0; // 通常は利用できるとして扱う name = _data.name; category = _data.category; type = _data.type; cell_type = _data.cell_type; description = _data.description; need_coin = _data.need_coin; need_ticket = _data.need_ticket; need_money = _data.need_money; size = _data.size; cost = _data.cost; area = _data.area; revenue = _data.revenue; revenue_interval = _data.revenue_interval; revenue_up = _data.revenue_up; production_time = _data.production_time; setting_limit = _data.setting_limit; sub_parts_id = _data.sub_parts_id; open_item_id = _data.open_item_id; revenue_up2 = _data.revenue_up2; add_coin = _data.add_coin; item_id = _data.item_id; }
private void SetPrice(DataItemMaster _data) { string strText = ""; string strImageName = ""; if (0 < _data.need_coin) { strImageName = "list_buy1"; strText = _data.need_coin.ToString() + "G"; } else if (0 < _data.need_ticket) { strImageName = "list_buy2"; strText = _data.need_ticket.ToString() + "枚"; } else if (0 < _data.need_money) { strImageName = "list_buy3"; strText = _data.need_money.ToString() + "円"; } else { Debug.LogError("no need"); } m_sprBuyBase.spriteName = strImageName; m_lbBuyPrice.text = strText; return; }
public DataItemMaster MakeData(SQLiteQuery _qr) { SQLiteQuery qr = _qr; DataItemMaster data = new DataItemMaster(); if (m_bDebugLog) { //Debug.Log( "key :" + strKey ); //Debug.Log( "value:" + strValue ); } data.item_id = qr.GetInteger("item_id"); data.status = qr.GetInteger("status"); data.name = qr.GetString("name"); data.category = qr.GetInteger("category"); data.type = qr.GetInteger("type"); data.cell_type = qr.GetInteger("cell_type"); data.description = qr.GetString("description"); data.need_coin = qr.GetInteger("need_coin"); data.need_ticket = qr.GetInteger("need_ticket"); data.need_money = qr.GetInteger("need_money"); data.size = qr.GetInteger("size"); data.cost = qr.GetInteger("cost"); data.area = qr.GetInteger("area"); data.revenue = qr.GetInteger("revenue"); data.revenue_interval = qr.GetInteger("revenue_interval"); data.revenue_up = qr.GetInteger("revenue_up"); data.production_time = qr.GetInteger("production_time"); data.setting_limit = qr.GetInteger("setting_limit"); data.sub_parts_id = qr.GetInteger("sub_parts_id"); data.open_item_id = qr.GetInteger("open_item_id"); data.revenue_up2 = qr.GetInteger("revenue_up2"); data.add_coin = qr.GetInteger("add_coin"); return(data); }
override protected void initialize() { m_ctrlFieldItem.gameObject.transform.parent = m_goRootPosition.transform; m_ctrlFieldItem.transform.localScale = Vector3.one; m_ctrlFieldItem.ResetPos(); DataItemMaster master_data = GameMain.dbItemMaster.Select(m_dataItem.item_id); Color color = new Color(0.75f, 0.75f, 0.75f); for (int x = m_dataItem.x - (master_data.area); x < m_dataItem.x + master_data.size + (master_data.area); x++) { for (int y = m_dataItem.y - (master_data.area); y < m_dataItem.y + master_data.size + (master_data.area); y++) { //Debug.Log ("x=" + x.ToString () + " y=" + y.ToString ()); //foreach (DataItem data_item in DataManager.Instance.m_ItemDataList) { foreach (CtrlFieldItem field_item in GameMain.ParkRoot.m_fieldItemList) { // xyが合ってて、シリアルは別 if (field_item.m_dataItem.x == x && field_item.m_dataItem.y == y && m_dataItem.item_serial != field_item.m_dataItem.item_serial) { //CtrlFieldItem script = GameMain.ParkRoot.GetFieldItem (data_item.item_serial); CtrlFieldItem script = field_item; m_areaFieldItem.Add(script); script.gameObject.transform.parent = m_goRootPosition.transform; script.gameObject.transform.localScale = Vector3.one; script.ResetPos(); } } } } /* * for( int x = m_dataItem.x - (master_data.area ) ; x < m_dataItem.x + master_data.size + (master_data.area ) ; x++ ){ * for( int y = m_dataItem.y - (master_data.area ) ; y < m_dataItem.y + master_data.size + (master_data.area ) ; y++ ){ * //Debug.Log ("x=" + x.ToString () + " y=" + y.ToString ()); * foreach (DataItem data_item in DataManager.Instance.m_ItemDataList) { * * // xyが合ってて、シリアルは別 * if (data_item.x == x && data_item.y == y && m_dataItem.item_serial != data_item.item_serial ) { * CtrlFieldItem script = GameMain.ParkRoot.GetFieldItem (data_item.item_serial); * m_areaFieldItem.Add (script); * script.gameObject.transform.parent = m_goRootPosition.transform; * script.ResetPos (); * } * } * } * } */ float fScale = 0.5f; m_goRootPosition.transform.localScale = new Vector3(fScale, fScale, fScale); m_goRootPosition.transform.localPosition = (-1.0f * Define.CELL_X_DIR.normalized * Define.CELL_X_LENGTH * m_dataItem.x) + (-1.0f * Define.CELL_Y_DIR.normalized * Define.CELL_Y_LENGTH * m_dataItem.y + new Vector3(0.0f, -240.0f, 0.0f)); m_goRootPosition.transform.localPosition *= fScale; return; }
public void Init(int _iX, int _iY, int _iItemId, ParkMain.EDIT_MODE _eEditMode = ParkMain.EDIT_MODE.NORMAL) { m_eStep = STEP.INIT; m_eStepPre = STEP.MAX; if (_eEditMode == ParkMain.EDIT_MODE.MOVE) { } else { m_iconRootList.Clear(); } m_dataItem.x = _iX; m_dataItem.y = _iY; change_sprite(m_sprItem, _iItemId); DataItemMaster master = GameMain.dbItemMaster.Select(_iItemId); m_dataItem.width = master.size; m_dataItem.height = master.size; m_dataItem.item_id = _iItemId; m_dataItem.category = master.category; m_dataItemMaster = master; SetPos(_iX, _iY); return; }
protected override void initialize() { m_WhereHash.Clear(); m_WhereHash.Add("@where_key01", "item_serial = " + GameMain.Instance.m_iSettingItemSerial.ToString()); m_WhereHash.Add("@where_key02", "item_serial = " + GameMain.Instance.m_iSettingItemSerial.ToString() + " and condition = " + ((int)Define.Monster.CONDITION.SICK).ToString() + " "); m_eStep = STEP.IDLE; m_eStepPre = STEP.MAX; m_iItemSerial = GameMain.Instance.m_iSettingItemSerial; Debug.Log("serial:" + m_iItemSerial.ToString()); GameObject objTabParent = PrefabManager.Instance.MakeObject("prefab/PrefTabParent", gameObject); m_tabParent = objTabParent.GetComponent <CtrlTabParent> (); m_tabParent.Init(ITEM_DETAIL_TABS); // ここはserialから対応した文字列を選択する必要があります m_pageHeader = makeHeader("header_shisetsu1", ITEM_DETAIL_TABS[0].m_strWordKey, "btn_katazuke"); makeCloseButton(); m_dataItem = GameMain.dbItem.Select(m_iItemSerial); m_dataItemMaster = GameMain.dbItemMaster.Select(m_dataItem.item_id); // これ、別のところでもやってます List <DataMonster> monster_list = GameMain.dbMonster.Select(" item_serial = " + m_iItemSerial.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(m_dataItem.item_id, m_dataItem.level); GameMain.Instance.m_iCostMax = detail_data.cost; GameMain.Instance.m_iCostNow = iUseCost; GameMain.Instance.m_iCostNokori = detail_data.cost - iUseCost; GameObject bannerParent = PrefabManager.Instance.MakeObject("prefab/PrefBannerScrollParent", gameObject); m_bannerScrollParen = bannerParent.GetComponent <BannerScrollParent> (); m_bannerScrollParen.Initialize(m_tabParent); m_iTabIndex = 0; m_iSwitchIndex = 0; Display(m_bannerScrollParen, ITEM_DETAIL_TABS, m_iTabIndex, m_iSwitchIndex); m_csKatazukeCheck = null; //m_dataItem.category }
/* * ここのWriteは即書き込み */ //DBへ保存 public void Replace(DataItemMaster _replocalData) { foreach (DataItemMaster data in m_soDataItemMaster.list) { if (data.item_id == _replocalData.item_id) { data.Copy(_replocalData); return; } } m_soDataItemMaster.list.Add(_replocalData); /* * * * //データの上書きのコマンドを設定する * string strQuery = "replace into " + TABLE_NAME + " (item_id,status,name,category,type,cell_type,description,need_coin,need_ticket,need_money,size,cost,area,revenue,revenue_interval,revenue_up,production_time,setting_limit,sub_parts_id,open_item_id,revenue_up2,add_coin) values( '" + * _replocalData.item_id.ToString () + "','" + * _replocalData.status.ToString () + "',\"" + * _replocalData.name.ToString () + "\",'" + * _replocalData.category.ToString () + "','" + * _replocalData.type.ToString () + "','" + * _replocalData.cell_type.ToString () + "',\"" + * _replocalData.description.ToString () + "\",'" + * _replocalData.need_coin.ToString () + "','" + * _replocalData.need_ticket.ToString () + "','" + * _replocalData.need_money.ToString () + "','" + * _replocalData.size.ToString () + "','" + * _replocalData.cost.ToString () + "','" + * _replocalData.area.ToString () + "','" + * _replocalData.revenue.ToString () + "','" + * _replocalData.revenue_interval.ToString () + "','" + * _replocalData.revenue_up.ToString () + "','" + * _replocalData.production_time.ToString () + "','" + * _replocalData.setting_limit.ToString () + "','" + * _replocalData.sub_parts_id.ToString () + "','" + * _replocalData.open_item_id.ToString () + "','" + * _replocalData.revenue_up2.ToString () + "','" + * _replocalData.add_coin.ToString () + "');"; * * Debug.Log( "DBPark:"+strQuery); * * //m_sqlDBはDBDataBaseのプロテクト変数 * SQLiteQuery query = new SQLiteQuery(m_sqlDB,strQuery); * * query.Step (); // * query.Release (); //解放 */ }
static public bool AbleSettingItem(DataItemMaster _dataItem, int _iX, int _iY, List <Grid> _gridList) { bool bRet = true; List <Grid> useGrid = new List <Grid> (); setUsingGrid(ref useGrid, _iX, _iY, _dataItem.size, _dataItem.size); foreach (Grid check_grid in useGrid) { if (check_grid.x < 0) { bRet = false; } else if (check_grid.y < 0) { bRet = false; } else if (DataManager.user.m_iWidth <= check_grid.x) { bRet = false; } else if (DataManager.user.m_iHeight <= check_grid.y) { bRet = false; } else { } } foreach (Grid check_grid in useGrid) { foreach (Grid field_grid in _gridList) { if (Grid.Equals(check_grid, field_grid) == true) { //Debug.Log ("you cant setting here!"); return(false); } } } //Debug.Log ("able set GOOD POSITION"); return(bRet); }
public bool Initialize(DataItem _data, int _iCostNokori) { DataItemMaster item_master = DataManager.GetItemMaster(_data.item_id); Initialize(item_master, _iCostNokori); m_iItemSerial = _data.item_serial; m_bIsUserData = true; m_sprBuyBase.gameObject.SetActive(false); //m_bAbleUse = DataManager.user.AbleBuy (0 , 0, 0 , _iCostNokori); m_bAbleUse = DataManager.user.AbleBuy(0, 0, 0, 0, 0, 0, ref m_eReason); //m_lbReason.gameObject.SetActive (!m_bAbleUse); SetReasonSprite(m_sprReason, m_eReason); m_sprIgnoreBlack.gameObject.SetActive(!m_bAbleUse); SetEnableIcon(m_bAbleUse); return(true); }
public void Init(DataItem _dataItem, CtrlParkRoot _parkRoot) { m_dataItem = _dataItem; m_csParkRoot = _parkRoot; m_iItemSerial = _dataItem.item_serial; m_bIsEnd = false; DataItemMaster master_data = GameMain.dbItemMaster.Select(_dataItem.item_id); m_lbName.text = master_data.name; m_lbUriage.text = UtilString.GetSyuunyuu(master_data.revenue, master_data.revenue); m_lbExp.text = ""; m_lbDescription.text = master_data.description; string strName = "item" + _dataItem.item_id.ToString(); m_sprItem.spriteName = strName; 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.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(); } }
override protected void initialize() { m_bRemove = false; m_areaFieldItem.Clear(); m_ctrlFieldItem.gameObject.transform.parent = m_goRootPosition.transform; m_ctrlFieldItem.gameObject.transform.localScale = Vector3.one; m_ctrlFieldItem.ResetPos(); DataItemMaster master_data = GameMain.dbItemMaster.Select(m_dataItem.item_id); CsvItemDetailData item_detail = DataManager.GetItemDetail(m_dataItem.item_id, m_dataItem.level); m_lbCostMax.text = item_detail.cost.ToString(); int iCostNow = 0; int iShisyutsu = 0; List <DataStaff> staff_list = GameMain.dbStaff.Select(" office_serial = " + m_dataItem.item_serial.ToString() + " "); foreach (DataStaff staff in staff_list) { CsvStaffData data = DataManager.GetStaff(staff.staff_id); iCostNow += data.cost; iShisyutsu += data.expenditure; // わかりにくい名前にしてしまったな } m_lbCostNow.text = iCostNow.ToString(); m_lbShisyutsu.text = iShisyutsu.ToString(); Debug.Log("count=" + DataManager.Instance.m_ItemDataList.Count); for (int x = m_dataItem.x - (master_data.area); x < m_dataItem.x + master_data.size + (master_data.area); x++) { for (int y = m_dataItem.y - (master_data.area); y < m_dataItem.y + master_data.size + (master_data.area); y++) { //Debug.Log ("x=" + x.ToString () + " y=" + y.ToString ()); //foreach (DataItem data_item in DataManager.Instance.m_ItemDataList) { foreach (CtrlFieldItem field_item in GameMain.ParkRoot.m_fieldItemList) { // xyが合ってて、シリアルは別 if (field_item.m_dataItem.x == x && field_item.m_dataItem.y == y && m_dataItem.item_serial != field_item.m_dataItem.item_serial) { //CtrlFieldItem script = GameMain.ParkRoot.GetFieldItem (data_item.item_serial); CtrlFieldItem script = field_item; m_areaFieldItem.Add(script); script.gameObject.transform.parent = m_goRootPosition.transform; script.gameObject.transform.localScale = Vector3.one; script.ResetPos(); } } } } /* * float fScale = 0.5f; * m_goRootPosition.transform.localPosition = (-1.0f * Define.CELL_X_DIR.normalized * Define.CELL_X_LENGTH * m_dataItem.x) + (-1.0f * Define.CELL_Y_DIR.normalized * Define.CELL_Y_LENGTH * m_dataItem.y + new Vector3(0.0f, -240.0f,0.0f )); */ float fScale = 0.5f; m_goRootPosition.transform.localScale = new Vector3(fScale, fScale, fScale); m_goRootPosition.transform.localPosition = (-1.0f * Define.CELL_X_DIR.normalized * Define.CELL_X_LENGTH * m_dataItem.x) + (-1.0f * Define.CELL_Y_DIR.normalized * Define.CELL_Y_LENGTH * m_dataItem.y + new Vector3(0.0f, -240.0f, 0.0f)); m_goRootPosition.transform.localPosition *= fScale; return; }
public int Insert(DataItemMaster _itemMaster, int _iStatus, int _iX, int _iY) { //データの上書きのコマンドを設定する string strCreateTime = TimeManager.StrNow(); string strOpenTime = TimeManager.StrGetTime(_itemMaster.production_time); DataItem insert_data = new DataItem(); insert_data.item_serial = m_soDataItem.list.Count + 1; // 事情があって+1 insert_data.item_id = _itemMaster.item_id; insert_data.category = _itemMaster.category; insert_data.level = 1; insert_data.status = _iStatus; insert_data.x = _iX; insert_data.y = _iY; insert_data.width = _itemMaster.size; insert_data.height = _itemMaster.size; insert_data.collect_time = strOpenTime; insert_data.create_time = strCreateTime; m_soDataItem.list.Add(insert_data); bool bHit = false; foreach (DataItem data in m_soDataItem.list) { if (data.item_serial == insert_data.item_serial) { bHit = true; Debug.LogError(string.Format("serial{0} x={1} y={2}", data.item_serial, data.x, data.y)); } } if (bHit == false) { Debug.LogError("no hit"); } return(insert_data.item_serial); /* * string strQuery = "replace into " + TABLE_NAME + " (item_id,category,level,status,x,y,width,height,collect_time,create_time) values( '" + * _itemMaster.item_id.ToString () + "','" + * _itemMaster.category.ToString () + "','" + * 1.ToString () + "','" + * _iStatus.ToString () + "','" + * _iX.ToString () + "','" + * _iY.ToString () + "','" + * _itemMaster.size.ToString () + "','" + * _itemMaster.size.ToString () + "','" + * strOpenTime + "','" + * strCreateTime + "');"; * Debug.Log( "DBPark.Insert:"+strQuery); * //m_sqlDBはDBDataBaseのプロテクト変数 * SQLiteQuery query = new SQLiteQuery(m_sqlDB,strQuery); * * query.Step (); // * query.Release (); //解放 * * List<DataItem> insert_item = Select (" status = " + _iStatus.ToString () + " and x=" + _iX.ToString () + " and y=" + _iY.ToString ()); * * if (insert_item.Count == 1) { * return insert_item [0].item_serial; * * } else { * return 0; * } */ }
// 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; } }
private string GetSpriteName(DataItemMaster _data) { return(GetItemSpriteName(_data.item_id)); }
public bool Initialize(DataItemMaster _data, int _iCostNokori) { bool bRet = true; m_iTicketNum = 0; m_ItemMaster = _data; m_bIsUserData = false; m_iItemId = _data.item_id; m_iItemSerial = 0; m_buttonBase = GetComponent <ButtonBase> (); m_lbTitle.text = _data.name; m_lbTitle2.text = m_lbTitle.text; m_lbDescription.text = _data.description; m_lbPrize.text = _data.size.ToString(); m_lbPrizeExp.text = _data.cost.ToString(); m_lbDifficulty.text = ""; string strIcon = GetSpriteName(_data); UIAtlas atlas = AtlasManager.Instance.GetAtlas(strIcon); m_sprIcon.atlas = atlas; m_sprIcon.spriteName = strIcon; SetPrice(_data); // 上限確認の為にここで所持数チェック int iHave = GameMain.dbItem.Select(string.Format(" item_id = {0} ", _data.item_id)).Count; m_bAbleUse = DataManager.user.AbleBuy(_data.need_coin, _data.need_ticket, 0, _iCostNokori, iHave, _data.setting_limit, ref m_eReason); SetReasonSprite(m_sprReason, m_eReason); m_sprIgnoreBlack.gameObject.SetActive(!m_bAbleUse); if ((Define.Item.Category)_data.category == Define.Item.Category.SHOP) { m_lbPrize.text = _data.size.ToString(); m_lbPrizeExp.text = ""; m_sprBackground.spriteName = "list_item_2"; m_lbDifficulty.text = UtilString.GetSyuunyuu(m_ItemMaster.revenue, m_ItemMaster.revenue_interval); } else if ((Define.Item.Category)_data.category == Define.Item.Category.EXPAND || (Define.Item.Category)_data.category == Define.Item.Category.GOLD || (Define.Item.Category)_data.category == Define.Item.Category.TICKET) { m_sprBackground.spriteName = "list_item_4"; m_lbPrize.text = ""; m_lbPrizeExp.text = ""; m_lbDifficulty.text = ""; } else { } SetEnableIcon(m_bAbleUse); // こっちのInitializeは通る //Debug.LogError ( string.Format( "item_id={0} setting_limit={1}" , _data.item_id,_data.setting_limit)); if (m_eReason == ABLE_BUY_REASON.LIMIT) { bRet = false; } m_eStep = STEP.IDLE; m_eStepPre = STEP.MAX; return(bRet); }
override protected void initialize() { bool bBuyAble = true; CtrlFieldItem moveFieldItem = null; if (m_parkMain.m_eEditMode == ParkMain.EDIT_MODE.NORMAL) { // 道路のみ特殊処理 // 道のみシリアルがあるものから利用 // あとあとを見越して、同じitem_idがあれば反応できるようにしておく if (GameMain.Instance.m_iSettingItemId == Define.ITEM_ID_ROAD) { List <DataItem> same_list = GameMain.dbItem.Select(string.Format(" item_id = {0} and status = {1} ", GameMain.Instance.m_iSettingItemId, (int)Define.Item.Status.NONE)); if (0 < same_list.Count) { GameMain.Instance.m_iSettingItemSerial = same_list [0].item_serial; } else { GameMain.Instance.m_iSettingItemSerial = 0; } } } else if (m_parkMain.m_eEditMode == ParkMain.EDIT_MODE.MOVE) { // そのまま使う // 自分を一度消す int iRemoveIndex = 0; foreach (CtrlFieldItem item in GameMain.ParkRoot.m_fieldItemList) { if (item.m_dataItem.item_serial == GameMain.Instance.m_iSettingItemSerial) { //item.Remove (); moveFieldItem = item; GameMain.Instance.m_iSettingItemId = moveFieldItem.m_dataItem.item_id; // 別にここでやる必要はない GameMain.ParkRoot.m_fieldItemList.RemoveAt(iRemoveIndex); break; } iRemoveIndex += 1; } DataItem dataItem = GameMain.dbItem.Select(GameMain.Instance.m_iSettingItemSerial); // 消す予定のところに新しい土地を設置する for (int x = dataItem.x; x < dataItem.x + dataItem.width; x++) { for (int y = dataItem.y; y < dataItem.y + dataItem.height; y++) { GameObject obj = PrefabManager.Instance.MakeObject("prefab/PrefFieldItem", GameMain.ParkRoot.gameObject); obj.name = "fielditem_" + x.ToString() + "_" + y.ToString(); CtrlFieldItem script = obj.GetComponent <CtrlFieldItem> (); script.Init(x, y, 0); GameMain.ParkRoot.m_fieldItemList.Add(script); } } } else { } //Debug.LogError (GameMain.Instance.m_iSettingItemSerial); if (m_parkMain.m_pageHeader == null) { m_parkMain.m_pageHeader = m_parkMain.makeHeader("header_item", "Setting1"); } m_editItemMaster = GameMain.dbItemMaster.Select(GameMain.Instance.m_iSettingItemId); m_DontSetGridList.Clear(); Release(m_goBuyType); if (GameMain.Instance.m_iSettingItemId == Define.ITEM_ID_ROAD && GameMain.Instance.m_iSettingItemSerial == 0 && GameMain.Instance.PreSettingItemId == Define.ITEM_ID_ROAD) { m_goBuyType = PrefabManager.Instance.MakeObject("prefab/PrefBuyType", gameObject); m_goBuyType.transform.localPosition = new Vector3(190.0f, 268.0f, 0.0f); BuyItemButton buy_type = m_goBuyType.GetComponent <BuyItemButton> (); string strBuyType = "[FF0000]購入[-]"; if (0 < GameMain.Instance.m_iSettingItemSerial) { strBuyType = "保管庫"; } buy_type.SetText(strBuyType); buy_type.SetText(string.Format("{0}G", m_editItemMaster.need_coin)); } if (m_YesNoButtonManager == null) { GameObject goButtonManager = PrefabManager.Instance.MakeObject("prefab/PrefYesNoButton", gameObject); goButtonManager.transform.localPosition = new Vector3(0.0f, -400.0f, 0.0f); m_YesNoButtonManager = goButtonManager.GetComponent <ButtonManager> (); m_YesNoButtonManager.ButtonInit(); m_YesNoButtonManager.TriggerClearAll(); } CtrlYesNoButton yes_no_button = m_YesNoButtonManager.gameObject.GetComponent <CtrlYesNoButton> (); m_eStep = STEP.IDLE; m_eStepPre = STEP.MAX; GameMain.Instance.m_bStartSetting = false; // ゾンビアイコンを00の位置に表示する m_iEditItemX = 3; m_iEditItemY = 3; GameMain.GetGrid(new Vector2(Screen.width / 2, Screen.height / 2), out m_iEditItemX, out m_iEditItemY); ParkMain.EDIT_MODE eEditMode = ParkMain.EDIT_MODE.NORMAL; Debug.Log(m_parkMain.m_eEditMode); if (m_parkMain.m_eEditMode == ParkMain.EDIT_MODE.NORMAL) { GameObject prefab = PrefabManager.Instance.PrefabLoadInstance("prefab/PrefFieldItem"); GameObject obj = PrefabManager.Instance.MakeObject(prefab, m_parkMain.goParkRoot); m_editItem = obj.GetComponent <CtrlFieldItem> (); } else if (m_parkMain.m_eEditMode == ParkMain.EDIT_MODE.MOVE) { eEditMode = ParkMain.EDIT_MODE.MOVE; m_editItem = moveFieldItem; //GameMain.ParkRoot.GetFieldItem (GameMain.Instance.m_iSettingItemSerial); m_iEditItemX = m_editItem.m_dataItem.x; m_iEditItemY = m_editItem.m_dataItem.y; Debug.Log(m_editItem.m_dataItem.item_id); } m_editItem.InitEdit(m_iEditItemX, m_iEditItemY, GameMain.Instance.m_iSettingItemId, eEditMode); //Debug.LogError( string.Format( "x:{0} y:{1}" , m_iEditItemX , m_iEditItemY )); // お金が足りる // 実際には道路しかひっかからないはず if (m_editItemMaster.need_coin <= DataManager.user.m_iGold) { bBuyAble = true; ; //OK } else { bBuyAble = false; } if (bBuyAble == false && 0 == GameMain.Instance.m_iSettingItemSerial) { yes_no_button.EnableButtonYes(false); } string strWhere = " status != 0 "; if (m_parkMain.m_eEditMode == ParkMain.EDIT_MODE.MOVE) { strWhere = string.Format(" status != {0} and item_serial != {1} ", (int)Define.Item.Status.NONE, GameMain.Instance.m_iSettingItemSerial); } DataManager.Instance.m_ItemDataList = GameMain.dbItem.Select(strWhere); Grid.SetUsingGrid(ref m_DontSetGridList, DataManager.Instance.m_ItemDataList); foreach (Grid dont in m_DontSetGridList) { //Debug.Log (string.Format ("x={0} y={1} ", dont.x, dont.y)); } bool bAbleSet = Grid.AbleSettingItem(m_editItemMaster, m_iEditItemX, m_iEditItemY, m_DontSetGridList); m_editItem.SetEditAble(bAbleSet); return; }