public void Initialize(int _iStageId, int _iWave) { int iItemCount = icon_list.Count; List <MasterStageShopItemParam> appear_item = DataManagerGame.Instance.masterStageShopItem.list.FindAll(p => p.stage_id == _iStageId && p.wave == _iWave); if (appear_item.Count == 0) { appear_item = DataManagerGame.Instance.masterStageShopItem.list.FindAll(p => p.stage_id == _iStageId && p.wave == 0); } if (appear_item.Count == 0) { appear_item = DataManagerGame.Instance.masterStageShopItem.list.FindAll(p => p.stage_id == 0 && p.wave == 0); } int[] item_prob = new int[appear_item.Count]; for (int i = 0; i < appear_item.Count; i++) { item_prob[i] = appear_item[i].prob; } for (int i = 0; i < iItemCount; i++) { int index = UtilRand.GetIndex(item_prob); int item_id = appear_item[index].item_id; MasterItemParam master = DataManagerGame.Instance.masterItem.list.Find(p => p.item_id == item_id); icon_list[i].Initialize(i, master); icon_list[i].OnClickIcon.RemoveAllListeners(); icon_list[i].OnClickIcon.AddListener((IconStageShopItem _icon) => { OnClickIcon.Invoke(_icon); }); } }
public DataCardParam RandomSelectFromHand() { List <DataCardParam> temp = list.FindAll(p => p.status == (int)STATUS.HAND); int[] select_prob = new int[temp.Count]; for (int i = 0; i < temp.Count; i++) { select_prob[i] = 100; } int index = UtilRand.GetIndex(select_prob); if (temp.Count <= index) { foreach (DataCardParam data in list) { Debug.Log(string.Format("card_id:{0} chara_id:{1} status:{2}", data.card_id, data.card_serial, (STATUS)data.status)); } } return(temp[index]); }
public int GetDropItemId() { int iRet = 0; int[] drop_prob_arr = new int[7] { drop_prob, // セットされたアイテム 1000, // ドロップCoin 20, // ドロップGem 10, // ドロップGemの秘伝書 drop_prob, // dtop_item_id_2 drop_prob, // dtop_item_id_3 15, // なんかメダルが設定されてたら }; int [] drop_item_id_arr = new int[7] { drop_item_id, 1, 2, 3, drop_item_id_2, drop_item_id_3, 1, // 差し替え必須 }; // Gemの秘伝書が3つ以上ある場合はそれ以上ドロップさせない DataItemParam gem_book_check = DataManager.Instance.dataItem.list.Find(p => p.item_id == Defines.ITEM_ID_GEM_BOOK && Defines.GEM_BOOK_DROP_LIMIT < p.num); if (gem_book_check != null) { drop_prob_arr[3] = 0; } MasterDungeonParam dungeon = DataManager.Instance.masterDungeon.list.Find(p => p.dungeon_id == Defines.CurrentDungeonID); //Debug.Log(dungeon.dungeon_label); if (dungeon.item_id_medal != 0) { drop_item_id_arr[6] = dungeon.item_id_medal; } int iResultIndex = UtilRand.GetIndex(drop_prob_arr); iRet = drop_item_id_arr[iResultIndex]; /* * if(iResultIndex== 0 ) * { * iRet = drop_item_id; * } * else * { * iRet = iResultIndex; * } */ return(iRet); }
public void Initialize(int _iStageId, int _iWave, int[] _iCharaIdArr) { //Debug.Log(_iStageId); foreach (Card c in card_list) { Destroy(c.gameObject); } card_list.Clear(); for (int i = 0; i < _iCharaIdArr.Length; i++) { Card c = PrefabManager.Instance.MakeScript <Card>(m_prefCard, m_goCardRoot); card_list.Add(c); } List <MasterStageCardParam> appear_card = DataManagerGame.Instance.masterStageCard.list.FindAll(p => p.stage_id == _iStageId && p.wave == _iWave); if (appear_card.Count == 0) { appear_card = DataManagerGame.Instance.masterStageCard.list.FindAll(p => p.stage_id == _iStageId && p.wave == 0); } int[] item_prob = new int[appear_card.Count]; //Debug.Log(appear_card.Count); for (int i = 0; i < appear_card.Count; i++) { item_prob[i] = appear_card[i].prob; } for (int i = 0; i < _iCharaIdArr.Length; i++) { int index = UtilRand.GetIndex(item_prob); DataCardParam add_card = new DataCardParam(); // tempシリアルを配布 MasterCardParam master = DataManagerGame.Instance.masterCard.list.Find(p => p.card_id == appear_card[index].card_id); add_card.Copy(master, _iCharaIdArr[i], i); /* * add_card.card_id = appear_card[index].card_id; * add_card.chara_id = _iCharaIdArr[i]; * //Debug.Log(add_card.chara_id); * * add_card.card_serial = i; */ //add_card.card_type = appear_card[index].card_type; //add_card.power = appear_card[index].power; card_list[i].Initialize(add_card, DataManagerGame.Instance.masterCardSymbol.list); } }
public static MasterStageEventParam GetRand(List <MasterStageEventParam> _event_list) { int[] prob_list = new int[_event_list.Count]; for (int i = 0; i < _event_list.Count; i++) { prob_list[i] = _event_list[i].prob; } int iIndex = UtilRand.GetIndex(prob_list); return(_event_list[iIndex]); }
private void create_enemies(int _iCurrentFloor, string _strDungeonId) { gameMain.ClearEnemy(); MasterFloorParam floor_param = DataManager.Instance.masterFloor.list.Find(p => p.dungeon_id == _strDungeonId && (p.start <= _iCurrentFloor && _iCurrentFloor <= p.end)); int[] enemy_index_prob = floor_param.GetEnemyIndexProb(); int enemy_num = UtilRand.GetRand(10, 3); int[] pos_index = new int[enemy_num]; int[] pos_index_prob = new int[10]; for (int i = 0; i < 10; i++) { pos_index_prob[i] = 100; } for (int i = 0; i < enemy_num; i++) { int iResult = UtilRand.GetIndex(pos_index_prob); pos_index[i] = iResult; pos_index_prob[iResult] = 0; //Debug.Log(iResult); } for (int i = 0; i < enemy_num; i++) { //float x = UtilRand.GetRange(8.5f, 3.5f); float x = 3.5f + ((8.5f - 3.5f) / 10.0f) * pos_index[i]; int index = UtilRand.GetIndex(enemy_index_prob); int enemy_id = floor_param.GetEnemyId_fromIndex(index); MasterEnemyParam enemy = DataManager.Instance.masterEnemy.list.Find(p => p.enemy_id == enemy_id); gameMain.CreateEnemy(enemy, x, false); } if (_iCurrentFloor % 10 == 0) { MasterEnemyParam boss = DataManager.Instance.masterEnemy.list.Find(p => p.enemy_id == floor_param.boss); DataEnemyParam data = gameMain.CreateEnemy(boss, 9.0f, true); gameMain.panelBossStatus.Initialize(data, boss); } else { gameMain.panelBossStatus.Disable(); } }
public static T GetParam <T>(ref List <T> _paramList, string _strProbField) { int[] probArr = new int[_paramList.Count]; for (int i = 0; i < _paramList.Count; i++) { FieldInfo field_info = _paramList[i].GetType().GetField(_strProbField); probArr[i] = (int)field_info.GetValue(_paramList[i]); } int index = UtilRand.GetIndex(probArr); return(_paramList[index]); //return UtilRand.GetIndex(probArr); //return UtilRand.GetIndex(probArr); }
public void Initialize(int _iNum, int _iStage, int _iWave, int[] _iCharaIdArr) { m_prefBattleBonusHolder.SetActive(false); BattleBonusHolder[] arr = m_goRootBBHolder.GetComponentsInChildren <BattleBonusHolder>(); foreach (BattleBonusHolder c in arr) { if (m_prefBattleBonusHolder != c.gameObject) { GameObject.Destroy(c.gameObject); } } battle_bonus_holder_list.Clear(); List <MasterStageBattleBonusParam> stage_bb_list = DataManagerGame.Instance.masterStageBattleBonus.list.FindAll(p => p.stage_id == _iStage && p.wave == _iWave); if (stage_bb_list.Count == 0) { stage_bb_list = DataManagerGame.Instance.masterStageBattleBonus.list.FindAll(p => p.stage_id == _iStage && p.wave == 0); } if (stage_bb_list.Count == 0) { stage_bb_list = DataManagerGame.Instance.masterStageBattleBonus.list.FindAll(p => p.stage_id == 0 && p.wave == _iWave); } int[] prob_arr = new int[stage_bb_list.Count]; for (int i = 0; i < stage_bb_list.Count; i++) { prob_arr[i] = stage_bb_list[i].prob; //Debug.Log(string.Format("index={0} prob={1}", i, prob_arr[i])); } for (int set_index = 0; set_index < _iNum; set_index++) { BattleBonusHolder holder = PrefabManager.Instance.MakeScript <BattleBonusHolder>(m_prefBattleBonusHolder, m_goRootBBHolder); holder.Reset(set_index + 1); for (int party_index = 0; party_index < _iCharaIdArr.Length; party_index++) { int index = UtilRand.GetIndex(prob_arr); //Debug.Log(index); MasterBattleBonusParam master_bb = DataManagerGame.Instance.masterBattleBonus.list.Find(p => p.battle_bonus_id == stage_bb_list[index].battle_bonus_id); holder.Add(master_bb, _iCharaIdArr[party_index]); } battle_bonus_holder_list.Add(holder); holder.OnClick.AddListener((int _iIndex) => { OnClickHolder.Invoke(_iIndex); }); } }
public bool IsSuccess() { bool bRet = false; int[] prob_arr = new int[] { prob_success, prob_fail }; if (UtilRand.GetIndex(prob_arr) == 0) { bRet = true; } return(bRet); }
public override void OnEnter() { base.OnEnter(); DateTime check_datetime; if (!DataManager.Instance.user_data.HasKey(Defines.KEY_LAST_REWARD_TIME_FREE_WEAPON)) { check_datetime = new DateTime(2020, 1, 1); } else { check_datetime = System.DateTime.Parse(DataManager.Instance.user_data.Read(Defines.KEY_LAST_REWARD_TIME_FREE_WEAPON)); } DataManager.Instance.user_data.Write( Defines.KEY_LAST_REWARD_TIME_FREE_WEAPON, NTPTimer.Instance.now.ToString("yyyy/MM/dd HH:mm:ss")); check_datetime = System.DateTime.Parse(DataManager.Instance.user_data.Read(Defines.KEY_LAST_REWARD_TIME_FREE_WEAPON)); GachaMain.Instance.OnGachaFinished.RemoveAllListeners(); GachaMain.Instance.OnGachaFinished.AddListener(() => { GachaMain.Instance.Close(); Finish(); }); List <MasterWeaponParam> hit_weapon_list = DataManager.Instance.masterWeapon.list.FindAll(p => 1 <= p.rarity && p.rarity <= 3); int[] prob_arr = new int[hit_weapon_list.Count]; for (int i = 0; i < hit_weapon_list.Count; i++) { prob_arr[i] = hit_weapon_list[i].GetGachaProbFree(); } int index = UtilRand.GetIndex(prob_arr); MasterWeaponParam get_weapon = hit_weapon_list[index]; DataManager.Instance.dataWeapon.Add(get_weapon.weapon_id); GachaMain.ChestData chest_data = new GachaMain.ChestData(); chest_data.rarity = get_weapon.rarity; chest_data.spr_item = shop.m_sprAtlasWeapon.GetSprite(get_weapon.sprite_name); chest_data.spr_chest = shop.m_sprAtlasIcons.GetSprite("chest_t_01"); DataManager.Instance.dataWeapon.Save(); DataManager.Instance.dataWeaponAlbum.Save(); DataManager.Instance.user_data.Save(); GachaMain.Instance.GachaSingle(chest_data); }
public string GetItemRouletteResult(int _iNum) { string ret = ""; ItemResult result = new ItemResult(); result.keys = new List <string>(); for (int i = 0; i < _iNum; i++) { int iTempIndex = UtilRand.GetIndex(m_iProbList); result.keys.Add(m_getItemList[iTempIndex].item_key); } result.result_index = UtilRand.GetRand(m_getItemList.Count); ret = JsonUtility.ToJson(result); //Debug.Log(ret); return(ret); }
public bool CardFill(int _iFillNum, ref List <DataCardParam> _add_list) { int _iExistNum = list.FindAll(p => p.status == (int)STATUS.HAND).Count; int iAdd = _iFillNum - _iExistNum; int[] create_prob_arr = new int[list.Count]; int deck_card = 0; for (int i = 0; i < list.Count; i++) { int prob = 0; if (list[i].status == (int)STATUS.DECK) { prob = 100; deck_card += 1; } else { } create_prob_arr[i] = prob; } int select_count = iAdd <= deck_card ? iAdd : deck_card; //Debug.Log(string.Format("fill={0} deck_card={1} add={2} select_count={3}", _iFillNum, deck_card, iAdd, select_count)); for (int i = 0; i < select_count; i++) { hand_number += 1; int select_index = UtilRand.GetIndex(create_prob_arr); list[select_index].status = (int)STATUS.HAND; list[select_index].order = hand_number; // 再選択させない create_prob_arr[select_index] = 0; _add_list.Add(list[select_index]); } return(iAdd <= deck_card); }
public override void OnEnter() { base.OnEnter(); List <MasterStageCardParam> appear_card = simulator.masterStageCard.list.FindAll(p => p.stage_id == stage_id.Value && p.wave == wave.Value); if (appear_card.Count == 0) { appear_card = simulator.masterStageCard.list.FindAll(p => p.stage_id == stage_id.Value && p.wave == 0); } int[] item_prob = new int[appear_card.Count]; //Debug.Log(appear_card.Count); for (int i = 0; i < appear_card.Count; i++) { item_prob[i] = appear_card[i].prob; } int index = UtilRand.GetIndex(item_prob); DataUnitParam left_chara = simulator.dataUnit.list.Find(p => p.unit == "chara" && p.position == "left"); DataCardParam add_card = new DataCardParam(); // tempシリアルを配布 //add_card.card_id = appear_card[index].card_id; //add_card.chara_id = left_chara.chara_id; //Debug.Log(add_card.chara_id); MasterCardParam master = simulator.masterCard.list.Find(p => p.card_id == appear_card[index].card_id); if (master == null) { } // シリアルはAddNewCardで設定し直し add_card.Copy(master, left_chara.chara_id, 0); simulator.dataCard.AddNewCard(add_card, DataCard.STATUS.DECK); Finish(); }
public override void OnEnter() { base.OnEnter(); List <MasterStageBattleBonusParam> stage_bb_list = simulator.masterStageBattleBonus.list.FindAll(p => p.stage_id == stage_id.Value && p.wave == wave.Value); if (stage_bb_list.Count == 0) { stage_bb_list = simulator.masterStageBattleBonus.list.FindAll(p => p.stage_id == stage_id.Value && p.wave == 0); } if (stage_bb_list.Count == 0) { stage_bb_list = simulator.masterStageBattleBonus.list.FindAll(p => p.stage_id == 0 && p.wave == wave.Value); } int[] prob_arr = new int[stage_bb_list.Count]; for (int i = 0; i < stage_bb_list.Count; i++) { prob_arr[i] = stage_bb_list[i].prob; //Debug.Log(string.Format("index={0} prob={1}", i, prob_arr[i])); } foreach (DataUnitParam unit in simulator.dataUnit.list.FindAll(p => p.unit == "chara")) { int index = UtilRand.GetIndex(prob_arr); //Debug.Log(index); MasterBattleBonusParam master_bb = simulator.masterBattleBonus.list.Find(p => p.battle_bonus_id == stage_bb_list[index].battle_bonus_id); //Debug.Log(master_bb.battle_bonus_id); //Debug.Log(master_bb.field); //Debug.Log(master_bb.param); simulator.dataUnit.AddAssist(unit, "bb", "バトルボーナス", unit.chara_id, master_bb.field, master_bb.param, -1); } Finish(); }
public void Initialize(int _iStageId, int _iWave) { int iItemCount = banner_list.Count; List <MasterStageItemParam> appear_item = DataManagerGame.Instance.masterStageItem.list.FindAll(p => p.stage_id == _iStageId && p.wave == _iWave); if (appear_item.Count == 0) { appear_item = DataManagerGame.Instance.masterStageItem.list.FindAll(p => p.stage_id == _iStageId && p.wave == 0); } int[] item_prob = new int[appear_item.Count]; for (int i = 0; i < appear_item.Count; i++) { item_prob[i] = appear_item[i].prob; } for (int i = 0; i < iItemCount; i++) { int index = UtilRand.GetIndex(item_prob); int item_id = appear_item[index].item_id; banner_list[i].Initialize(item_id); } }
public override void OnEnter() { base.OnEnter(); int enemy_chara_id = 0; if (is_boss.Value == false) { Debug.Log("battle_start"); List <MasterStageEnemyParam> appear_enemy_list = simulator.masterStageEnemy.list.FindAll(p => p.stage_id == stage_id.Value && p.wave == wave.Value); if (appear_enemy_list.Count == 0) { appear_enemy_list = simulator.masterStageEnemy.list.FindAll(p => p.stage_id == stage_id.Value && p.wave == 0); } int[] enemy_prob = new int[appear_enemy_list.Count]; for (int i = 0; i < appear_enemy_list.Count; i++) { enemy_prob[i] = appear_enemy_list[i].prob; } int index = UtilRand.GetIndex(enemy_prob); // chara_id = enemy_idです //GameMain.Instance.battleMain.RequestBattle.Invoke(false, appear_enemy_list[index].enemy_id); enemy_chara_id = appear_enemy_list[index].enemy_id; } else { MasterStageParam master_stage = simulator.masterStage.list.Find(p => p.stage_id == stage_id.Value); enemy_chara_id = master_stage.boss_chara_id; } create_enemy(enemy_chara_id); Finish(); }
public MasterStageMissionParam Select(int _iStageId , int _iWave) { List<MasterStageMissionParam> stage_mission_list = list.FindAll(p => p.stage_id == _iStageId && p.wave == _iWave); if(stage_mission_list.Count == 0) { Debug.Log("stage_mission_list.Count == 0"); stage_mission_list = list.FindAll(p => p.stage_id == _iStageId && p.wave == 0); } //Debug.Log(_iStageId); //Debug.Log(_iWave); //Debug.Log(stage_mission_list.Count); int[] prob_arr = new int[stage_mission_list.Count]; for( int i = 0; i < prob_arr.Length; i++) { prob_arr[i] = stage_mission_list[i].prob; } int iSelectIndex = UtilRand.GetIndex(prob_arr); return stage_mission_list[iSelectIndex]; }
public override void OnEnter() { base.OnEnter(); shop.m_goBannerWeaponFree.SetActive(true); shop.m_goBannerWeapon1.SetActive(true); shop.m_goBannerWeapon2.SetActive(true); if (!DataManager.Instance.user_data.HasKey(Defines.KEY_LAST_REWARD_TIME_FREE_WEAPON)) { check_datetime = new DateTime(2020, 1, 1); } else { check_datetime = System.DateTime.Parse(DataManager.Instance.user_data.Read(Defines.KEY_LAST_REWARD_TIME_FREE_WEAPON)); } button_interactable(); shop.m_goWeaponFreeButtonRoot.SetActive(false); shop.m_goWeaponFreeTimeRoot.SetActive(false); int weapon_num = DataManager.Instance.dataWeapon.list.Count; shop.m_goLimitCoverWeaponFree.SetActive(!(weapon_num + 1 <= Defines.WEAPON_NUM_LIMIT)); shop.m_goLimitCoverWeaponOne.SetActive(!(weapon_num + 1 <= Defines.WEAPON_NUM_LIMIT)); shop.m_goLimitCoverWeaponTen.SetActive(!(weapon_num + 10 <= Defines.WEAPON_NUM_LIMIT)); shop.m_btnWeaponFree.onClick.AddListener(() => { Fsm.Event("free"); }); shop.m_btnWeapon1.onClick.AddListener(() => { DataManager.Instance.UseGem(50); button_interactable(); GachaMain.Instance.OnGachaFinished.RemoveAllListeners(); GachaMain.Instance.OnGachaFinished.AddListener(() => { GachaMain.Instance.Close(); int weapon_num2 = DataManager.Instance.dataWeapon.list.Count; shop.m_goLimitCoverWeaponFree.SetActive(!(weapon_num2 + 1 <= Defines.WEAPON_NUM_LIMIT)); shop.m_goLimitCoverWeaponOne.SetActive(!(weapon_num2 + 1 <= Defines.WEAPON_NUM_LIMIT)); shop.m_goLimitCoverWeaponTen.SetActive(!(weapon_num2 + 10 <= Defines.WEAPON_NUM_LIMIT)); }); List <MasterWeaponParam> hit_weapon_list = DataManager.Instance.masterWeapon.list.FindAll(p => 2 <= p.rarity && p.rarity <= 5); int[] prob_arr = new int[hit_weapon_list.Count]; for (int i = 0; i < hit_weapon_list.Count; i++) { prob_arr[i] = hit_weapon_list[i].GetGachaProb(); } int index = UtilRand.GetIndex(prob_arr); MasterWeaponParam get_weapon = hit_weapon_list[index]; DataManager.Instance.dataWeapon.Add(get_weapon.weapon_id); GachaMain.ChestData chest_data = new GachaMain.ChestData(); chest_data.rarity = get_weapon.rarity; chest_data.spr_item = shop.m_sprAtlasWeapon.GetSprite(get_weapon.sprite_name); chest_data.spr_chest = shop.m_sprAtlasIcons.GetSprite("chest_t_01"); DataManager.Instance.dataWeapon.Save(); DataManager.Instance.dataWeaponAlbum.Save(); DataManager.Instance.user_data.Save(); GachaMain.Instance.GachaSingle(chest_data); }); shop.m_btnWeapon2.onClick.AddListener(() => { DataManager.Instance.UseGem(450); button_interactable(); GachaMain.Instance.OnGachaFinished.RemoveAllListeners(); GachaMain.Instance.OnGachaFinished.AddListener(() => { GachaMain.Instance.Close(); int weapon_num2 = DataManager.Instance.dataWeapon.list.Count; shop.m_goLimitCoverWeaponFree.SetActive(!(weapon_num2 + 1 <= Defines.WEAPON_NUM_LIMIT)); shop.m_goLimitCoverWeaponOne.SetActive(!(weapon_num2 + 1 <= Defines.WEAPON_NUM_LIMIT)); shop.m_goLimitCoverWeaponTen.SetActive(!(weapon_num2 + 10 <= Defines.WEAPON_NUM_LIMIT)); }); List <MasterWeaponParam> hit_weapon_list = DataManager.Instance.masterWeapon.list.FindAll(p => 2 <= p.rarity && p.rarity <= 5); int[] prob_arr = new int[hit_weapon_list.Count]; for (int i = 0; i < hit_weapon_list.Count; i++) { prob_arr[i] = hit_weapon_list[i].GetGachaProb(); } List <GachaMain.ChestData> chest_list = new List <GachaMain.ChestData>(); for (int i = 0; i < 10; i++) { int index = UtilRand.GetIndex(prob_arr); MasterWeaponParam get_weapon = hit_weapon_list[index]; DataManager.Instance.dataWeapon.Add(get_weapon.weapon_id); GachaMain.ChestData chest_data = new GachaMain.ChestData(); chest_data.rarity = get_weapon.rarity; chest_data.spr_item = shop.m_sprAtlasWeapon.GetSprite(get_weapon.sprite_name); chest_data.spr_chest = shop.m_sprAtlasIcons.GetSprite("chest_t_01"); chest_list.Add(chest_data); } DataManager.Instance.dataWeapon.Save(); DataManager.Instance.dataWeaponAlbum.Save(); DataManager.Instance.user_data.Save(); GachaMain.Instance.GachaMulti(chest_list); }); }
public override void OnEnter() { base.OnEnter(); shop.m_goBannerTreasureFree.SetActive(true); shop.m_goBannerTreasure1.SetActive(true); shop.m_goBannerTreasure2.SetActive(true); if (!DataManager.Instance.user_data.HasKey(Defines.KEY_LAST_REWARD_TIME_FREE_TREASURE)) { check_datetime = new DateTime(2020, 1, 1); } else { check_datetime = System.DateTime.Parse(DataManager.Instance.user_data.Read(Defines.KEY_LAST_REWARD_TIME_FREE_TREASURE)); } button_interactable(); shop.m_goTreasureFreeButtonRoot.SetActive(false); shop.m_goTreasureFreeTimeRoot.SetActive(false); int treasure_num = DataManager.Instance.dataTreasure.list.Count; shop.m_goLimitCoverTreasureFree.SetActive(!(treasure_num + 1 <= Defines.TREASURE_NUM_LIMIT)); shop.m_goLimitCoverTreasureNormal.SetActive(!(treasure_num + 1 <= Defines.TREASURE_NUM_LIMIT)); shop.m_goLimitCoverTreasureGold.SetActive(!(treasure_num + 10 <= Defines.TREASURE_NUM_LIMIT)); shop.m_btnTreasureFree.onClick.AddListener(() => { Fsm.Event("free"); }); shop.m_btnTreasure1.onClick.AddListener(() => { DataManager.Instance.UseKey(50); button_interactable(); GachaMain.Instance.OnGachaFinished.RemoveAllListeners(); GachaMain.Instance.OnGachaFinished.AddListener(() => { GachaMain.Instance.Close(); int treasure_num2 = DataManager.Instance.dataTreasure.list.Count; shop.m_goLimitCoverTreasureFree.SetActive(!(treasure_num2 + 1 <= Defines.TREASURE_NUM_LIMIT)); shop.m_goLimitCoverTreasureNormal.SetActive(!(treasure_num2 + 1 <= Defines.TREASURE_NUM_LIMIT)); shop.m_goLimitCoverTreasureGold.SetActive(!(treasure_num2 + 10 <= Defines.TREASURE_NUM_LIMIT)); }); List <MasterTreasureParam> hit_list = DataManager.Instance.masterTreasure.list.FindAll(p => 2 <= p.rarity && p.rarity <= 3); int[] prob_arr = new int[hit_list.Count]; for (int i = 0; i < hit_list.Count; i++) { prob_arr[i] = hit_list[i].GetGachaProb(); } int index = UtilRand.GetIndex(prob_arr); MasterTreasureParam get_item = hit_list[index]; DataManager.Instance.dataTreasure.Add(get_item.treasure_id); GachaMain.ChestData chest_data = new GachaMain.ChestData(); chest_data.rarity = get_item.rarity; chest_data.spr_item = shop.m_sprAtlasTreasure.GetSprite(get_item.sprite_name); chest_data.spr_chest = shop.m_sprAtlasIcons.GetSprite("chest_t_01"); DataManager.Instance.dataTreasure.Save(); DataManager.Instance.dataTreasureAlbum.Save(); DataManager.Instance.user_data.Save(); GachaMain.Instance.GachaSingle(chest_data); }); shop.m_btnTreasure2.onClick.AddListener(() => { DataManager.Instance.UseGoldKey(50); button_interactable(); GachaMain.Instance.OnGachaFinished.RemoveAllListeners(); GachaMain.Instance.OnGachaFinished.AddListener(() => { GachaMain.Instance.Close(); int treasure_num2 = DataManager.Instance.dataTreasure.list.Count; shop.m_goLimitCoverTreasureFree.SetActive(!(treasure_num2 + 1 <= Defines.TREASURE_NUM_LIMIT)); shop.m_goLimitCoverTreasureNormal.SetActive(!(treasure_num2 + 1 <= Defines.TREASURE_NUM_LIMIT)); shop.m_goLimitCoverTreasureGold.SetActive(!(treasure_num2 + 10 <= Defines.TREASURE_NUM_LIMIT)); }); List <MasterTreasureParam> hit_list = DataManager.Instance.masterTreasure.list.FindAll(p => 3 <= p.rarity && p.rarity <= 5); int[] prob_arr = new int[hit_list.Count]; for (int i = 0; i < hit_list.Count; i++) { prob_arr[i] = hit_list[i].GetGachaProb(); } int index = UtilRand.GetIndex(prob_arr); MasterTreasureParam get_item = hit_list[index]; if (shop.m_sprAtlasTreasure.GetSprite(get_item.sprite_name) == null) { Debug.Log(get_item.sprite_name); } DataManager.Instance.dataTreasure.Add(get_item.treasure_id); GachaMain.ChestData chest_data = new GachaMain.ChestData(); chest_data.rarity = get_item.rarity; chest_data.spr_item = shop.m_sprAtlasTreasure.GetSprite(get_item.sprite_name); chest_data.spr_chest = shop.m_sprAtlasIcons.GetSprite("chest_t_01"); DataManager.Instance.dataTreasure.Save(); DataManager.Instance.dataTreasureAlbum.Save(); DataManager.Instance.user_data.Save(); GachaMain.Instance.GachaSingle(chest_data); }); }
public void Use(int _iScrollId, int _iCreateNum) { DataItemParam data = DataManager.Instance.dataItem.list.Find(p => p.item_id == _iScrollId); data.num -= _iCreateNum * 10; // 必要が出たらコンバートして int iRarity = _iScrollId - (Defines.ITEM_ID_SCROLL_BLUE - 1); List <MasterWeaponParam> hit_weapon_list = DataManager.Instance.masterWeapon.list.FindAll(p => p.rarity == iRarity); int[] prob_arr = new int[hit_weapon_list.Count]; for (int i = 0; i < hit_weapon_list.Count; i++) { prob_arr[i] = hit_weapon_list[i].GetGachaProb(); } if (_iCreateNum == 1) { int index = UtilRand.GetIndex(prob_arr); MasterWeaponParam get_weapon = hit_weapon_list[index]; DataManager.Instance.dataWeapon.Add(get_weapon.weapon_id); GachaMain.ChestData chest_data = new GachaMain.ChestData(); chest_data.rarity = get_weapon.rarity; chest_data.spr_item = shop.m_sprAtlasWeapon.GetSprite(get_weapon.sprite_name); chest_data.spr_chest = shop.m_sprAtlasIcons.GetSprite("chest_t_01"); DataManager.Instance.dataItem.Save(); DataManager.Instance.dataWeapon.Save(); DataManager.Instance.dataWeaponAlbum.Save(); DataManager.Instance.user_data.Save(); GachaMain.Instance.GachaSingle(chest_data); GachaMain.Instance.OnGachaFinished.RemoveAllListeners(); GachaMain.Instance.OnGachaFinished.AddListener(() => { GachaMain.Instance.Close(); }); } else { List <GachaMain.ChestData> chest_list = new List <GachaMain.ChestData>(); for (int i = 0; i < _iCreateNum; i++) { int index = UtilRand.GetIndex(prob_arr); MasterWeaponParam get_weapon = hit_weapon_list[index]; DataManager.Instance.dataWeapon.Add(get_weapon.weapon_id); GachaMain.ChestData chest_data = new GachaMain.ChestData(); chest_data.rarity = get_weapon.rarity; chest_data.spr_item = shop.m_sprAtlasWeapon.GetSprite(get_weapon.sprite_name); chest_data.spr_chest = shop.m_sprAtlasIcons.GetSprite("chest_t_01"); chest_list.Add(chest_data); } DataManager.Instance.dataItem.Save(); DataManager.Instance.dataWeapon.Save(); DataManager.Instance.dataWeaponAlbum.Save(); DataManager.Instance.user_data.Save(); GachaMain.Instance.GachaMulti(chest_list); GachaMain.Instance.OnGachaFinished.RemoveAllListeners(); GachaMain.Instance.OnGachaFinished.AddListener(() => { GachaMain.Instance.Close(); }); } ScrollInfoUpdate(); ButtonInteractable(); }
static void Open() { GameObject obj = Selection.activeGameObject; if (obj == null) { Debug.Log("Please Select Object"); return; } int iRange = 100; Debug.Log("start"); // とりあえず100個作る for (int i = 0; i < 1000; i++) { List <int> result_list = new List <int> (); result_list.Clear(); int[] table = new int[iRange]; for (int table_index = 0; table_index < iRange; table_index++) { int iProbParam = 100; if (table_index == 0) { iProbParam = 0; } else if (table_index < 10) { iProbParam /= 3; } else { } table [table_index] = iProbParam; } int iNumberTemp = 0; int iNumberResult = 0; for (int result_num = 0; result_num < 9; result_num++) { iNumberTemp = UtilRand.GetIndex(table); iNumberResult += iNumberTemp; table [iNumberTemp] = 0; result_list.Add(iNumberTemp); } int iHitCount = 0; for (int x = 0; x < result_list.Count - 2; x++) { for (int y = x + 1; y < result_list.Count - 1; y++) { for (int z = y + 1; z < result_list.Count; z++) { if (x != y && y != z && z != x) { int iSum = result_list [x] + result_list [y] + result_list [z]; List <int> check_list = new List <int> (); for (int check = 0; check < result_list.Count; check++) { if (check == x) { } else if (check == y) { } else if (check == z) { } else { check_list.Add(result_list [check]); } } bool temphit = false; List <int> sum_list = GetChoiceSumList(3, check_list, iSum); foreach (int sum_result in sum_list) { if (iSum == sum_result) { iHitCount += 1; temphit = true; } } if (temphit == true) { //Debug.Log (string.Format ("sum={0} ({1},{2},{3})", iSum, result_list [x], result_list [y], result_list [z])); } //ret_list.Add (iSum); } } } } if (iHitCount == 2) { Debug.Log(string.Format("HitCount:{0} ({1},{2},{3},{4},{5},{6},{7},{8},{9})", iHitCount, result_list [0], result_list [1], result_list [2], result_list [3], result_list [4], result_list [5], result_list [6], result_list [7], result_list [8])); Textreader.Append("/../text.csv", string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", iHitCount, result_list [0], result_list [1], result_list [2], result_list [3], result_list [4], result_list [5], result_list [6], result_list [7], result_list [8])); } } Debug.Log("end"); /* * foreach (Transform child in obj.transform) { * Debug.Log (child.gameObject.name); * Textreader.write (string.Format ("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}" , * child.name, * child.localPosition.x, * child.localPosition.y, * child.localPosition.z, * child.localEulerAngles.x, * child.localEulerAngles.y, * child.localEulerAngles.z, * child.localScale.x, * child.localScale.y, * child.localScale.z * )); * } */ }
public override void OnEnter() { base.OnEnter(); // 一応ね //enemy.hp_bar.SetValueMax(enemy.dataUnitParam.hp_max); //enemy.hp_bar.SetValueCurrent(enemy.dataUnitParam.hp); enemy.m_animatorBody.enabled = true; DropObject drop = PrefabManager.Instance.MakeScript <DropObject>(enemy.drop_object.gameObject, enemy.gameObject.transform.parent.gameObject); drop.transform.position = enemy.m_enemyBody.gameObject.transform.position; MasterItemParam master_item = DataManager.Instance.masterItem.list.Find(p => p.item_id == 1); drop.Initialize(master_item, GameMain.Instance.master_floor_param.GetCoinNum()); int[] drop_item_prob_arr = new int[5] { 1000, // 落とさない 150, // ノーマルドロップ 30, // レアドロップ 150, // カギ 5, // ゴールドキー }; drop_item_prob_arr[0] -= GameMain.Instance.player_chara.m_dataUnitParam.luck; if (drop_item_prob_arr[0] < 0) { drop_item_prob_arr[0] = 0; } int drop_index = UtilRand.GetIndex(drop_item_prob_arr); int drop_item_id = 0; if (drop_index == 1) { drop_item_id = GameMain.Instance.master_floor_param.drop_item_id; } else if (drop_index == 2) { drop_item_id = GameMain.Instance.master_floor_param.rare_item_id; } else if (drop_index == 3) { // たまたまです drop_item_id = 3; } else if (drop_index == 4) { // たまたまです drop_item_id = 4; } if (0 < drop_item_id) { DropObject drop_item = PrefabManager.Instance.MakeScript <DropObject>(enemy.drop_object.gameObject, enemy.gameObject.transform.parent.gameObject); drop.transform.position = enemy.m_enemyBody.gameObject.transform.position; MasterItemParam master_item_drop = DataManager.Instance.masterItem.list.Find(p => p.item_id == drop_item_id); drop.Initialize(master_item_drop, 1); } enemy.m_enemyBody.gameObject.layer = LayerMask.NameToLayer("dead"); GameObject.Destroy(enemy.m_rbEnemy); GameObject.Destroy(enemy.m_bcEnemy); enemy.m_animatorBody.SetBool("dead", true); //GameObject.Destroy(enemy.hp_bar.gameObject, 3); GameObject.Destroy(enemy.gameObject, 3); Finish(); }