Exemple #1
0
    public void BuildPlayer()
    {
        int total_attack = 0;
        int total_speed  = 0;

        int total_hp   = 0;
        int total_def  = 0;
        int total_mind = 0;
        int total_luck = 0;
        int total_move = 100;
        int total_heal = 100;
        int total_coin = 100;

        DataWeaponParam   data_equip_weapon   = DataManager.Instance.dataWeapon.list.Find(p => 0 < p.equip);
        MasterWeaponParam master_equip_weapon = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data_equip_weapon.weapon_id);

        // レベルの校正
        MasterWeaponParam master_equip_weapon_level = master_equip_weapon.GetParam(data_equip_weapon.level);

        total_attack = master_equip_weapon_level.attack;
        total_speed  = master_equip_weapon_level.speed;

        for (int i = 0; i < MasterArmor.ArmorPositionArr.Length; i++)
        {
            DataArmorParam   data   = DataManager.Instance.dataArmor.list.Find(p => p.position == MasterArmor.ArmorPositionArr[i]);
            MasterArmorParam master = DataManager.Instance.masterArmor.list.Find(p => p.armor_id == data.armor_id);
            total_hp   += master.hp;
            total_def  += master.def;
            total_mind += master.mind;
            total_luck += master.luck;
        }

        List <DataTreasureParam> data_treasure_list = DataManager.Instance.dataTreasure.list.FindAll(p => 0 < p.equip);

        TreasureAssist assist = TreasureAssist.GetTreasureAssist(data_treasure_list);

        total_hp     = Mathf.CeilToInt((float)total_hp * (float)((float)assist.hp / 100.0f));
        total_attack = Mathf.CeilToInt((float)total_attack * (float)((float)assist.attack / 100.0f));
        total_def    = Mathf.CeilToInt((float)total_def * (float)((float)assist.def / 100.0f));
        total_mind   = Mathf.CeilToInt((float)total_mind * (float)((float)assist.mind / 100.0f));
        total_move   = Mathf.CeilToInt((float)total_move * (float)((float)assist.move / 100.0f));
        total_heal   = Mathf.CeilToInt((float)total_heal * (float)((float)assist.heal / 100.0f));
        total_luck   = Mathf.CeilToInt((float)total_luck * (float)((float)assist.luck / 100.0f));
        total_coin   = Mathf.CeilToInt((float)total_coin * (float)((float)assist.coin / 100.0f));

        hp     = total_hp;
        hp_max = total_hp;

        attack = total_attack;
        speed  = total_speed;
        def    = total_def;
        mind   = total_mind;
        luck   = total_luck;

        move = total_move;
        heal = total_heal;
        coin = total_coin;

        //Debug.Log(string.Format("HP:{0} atk:{1} def:{2}", hp_max, attack, def));
    }
Exemple #2
0
        public override void OnEnter()
        {
            base.OnEnter();

            // いったん自動リセット
            chara.m_charaBody.transform.localPosition = Vector3.zero;

            chara.is_goal = false;
            chara.m_dataUnitParam.BuildPlayer();

            DataWeaponParam my_weapon = DataManager.Instance.dataWeapon.list.Find(p => p.equip != 0);

            chara.m_masterWeaponParam = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == my_weapon.weapon_id);
            Debug.Log(chara.m_masterWeaponParam.weapon_type);
            DataCharaParam   data_chara   = DataManager.Instance.dataChara.list.Find(p => p.status == DataChara.STATUS.USING.ToString());
            MasterCharaParam master_chara = DataManager.Instance.masterChara.list.Find(p => p.chara_id == data_chara.chara_id);

            chara.m_overrideSprite.overrideTexture = TextureManager.Instance.Get(master_chara.texture_name);

            chara.m_imgHpBar.transform.localScale = Vector3.one;
            chara.m_txtHp.text = string.Format("{0}/{1}", chara.m_dataUnitParam.hp, chara.m_dataUnitParam.hp_max);

            //chara.m_hpBar.SetValueMax(chara.m_dataUnitParam.hp_max);
            //chara.m_hpBar.SetValueCurrent(chara.m_dataUnitParam.hp);
            Finish();
        }
Exemple #3
0
        public override void OnEnter()
        {
            base.OnEnter();

            main.m_goBuyWindow.SetActive(true);

            DataWeaponParam   data   = DataManager.Instance.dataWeapon.list.Find(p => p.serial == weapon_serial.Value);
            MasterWeaponParam master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data.weapon_id);

            main.icon_buy.Initialize(data, master);
            main.m_txtPrice.text = MasterWeapon.GetSellPrice(data, master).ToString();

            main.m_btnBuyYes.onClick.AddListener(() =>
            {
                DataWeaponParam remove_data     = DataManager.Instance.dataWeapon.list.Find(p => p.serial == weapon_serial.Value);
                MasterWeaponParam remove_master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == remove_data.weapon_id);

                int add_gold = MasterWeapon.GetSellPrice(remove_data, remove_master);
                DataManager.Instance.AddCoin(add_gold);
                DataManager.Instance.dataWeapon.list.Remove(remove_data);

                DataManager.Instance.dataWeapon.Save();
                DataManager.Instance.user_data.Save();

                Fsm.Event("buy");
            });
            main.m_btnBuyCancel.onClick.AddListener(() =>
            {
                Fsm.Event("cancel");
            });
        }
Exemple #4
0
        private void OnSelectListWeapon(DataWeaponParam arg0)
        {
            main.SelectListData_weapon_id(arg0.weapon_id);
            MasterWeaponParam master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == arg0.weapon_id);

            main.m_weaponInfo.Setup(arg0, master);
        }
Exemple #5
0
        private void OnSelectListWeapon(DataWeaponParam arg0)
        {
            weapon_serial.Value = arg0.serial;
            main.SelectListData(arg0.serial);

            MasterWeaponParam master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == arg0.weapon_id);

            main.m_weaponInfo.Setup(arg0, master);

            DataWeaponParam data_equip = DataManager.Instance.dataWeapon.list.Find(p => 0 < p.equip);

            main.m_btnEquip.interactable = arg0.serial != data_equip.serial;
        }
Exemple #6
0
        public override void OnEnter()
        {
            base.OnEnter();
            main.m_goBulkBuyWindow.SetActive(true);

            main.m_btnBuyBulk.interactable = false;

            main.m_btnEquip.gameObject.SetActive(false);
            main.m_btnAlbum.gameObject.SetActive(false);
            main.m_btnBulk.gameObject.SetActive(false);

            main.m_btnCancel.onClick.RemoveAllListeners();
            main.m_btnCancel.onClick.AddListener(() =>
            {
                Finish();
            });
            main.m_txtBulkCoin.text = "0";

            bulk_list.Clear();
            foreach (IconInventry icon in main.weapon_list)
            {
                icon.OnSelect(false);
                icon.OnClickWeapon.AddListener(OnSelectListWeapon);
            }
            main.m_btnList.gameObject.SetActive(true);
            main.m_btnList.onClick.AddListener(() =>
            {
                Fsm.Event("list");
            });

            main.m_btnBuyBulk.onClick.RemoveAllListeners();
            main.m_btnBuyBulk.onClick.AddListener(() =>
            {
                int total_price = 0;

                foreach (DataWeaponParam buy in bulk_list)
                {
                    DataWeaponParam data     = DataManager.Instance.dataWeapon.list.Find(p => p.serial == buy.serial);
                    MasterWeaponParam master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data.weapon_id);
                    total_price += MasterWeapon.GetSellPrice(data, master);
                }
                DataManager.Instance.AddCoin(total_price);
                foreach (DataWeaponParam buy in bulk_list)
                {
                    DataManager.Instance.dataWeapon.list.Remove(buy);
                }
                DataManager.Instance.dataWeapon.Save();
                DataManager.Instance.user_data.Save();
                Finish();
            });
        }
Exemple #7
0
    public void Setup(DataWeaponParam _data, MasterWeaponParam _master)
    {
        m_icon.Initialize(_data, _master);
        if (_master != null)
        {
            m_txtName.text    = _master.name;
            m_txtOutline.text = _master.name;
        }
        else
        {
            m_txtName.text    = "なし";
            m_txtOutline.text = "-----";
        }

        if (10 <= _data.level)
        {
            m_txtGradeupPrice.text    = "強化上限";
            m_btnGradeup.interactable = false;
        }
        else
        {
            if (_master != null)
            {
                int price = MasterWeapon.GetGradeupPrice(_data, _master);
                m_txtGradeupPrice.text = price.ToString();

                m_btnGradeup.interactable = price <= DataManager.Instance.GetCoin();
            }
            else
            {
                m_txtGradeupPrice.text    = "-----";
                m_btnGradeup.interactable = false;
            }
        }
        m_btnBuyCheck.interactable = _data.weapon_id != 0 && _data.equip == 0;


        if (_master != null)
        {
            MasterWeaponParam equip_level = _master.GetParam(_data.level);
            m_txtAttack.text = equip_level.attack.ToString();
            m_txtSpeed.text  = equip_level.speed.ToString();
        }
        else
        {
            m_txtAttack.text = "---";
            m_txtSpeed.text  = "---";
        }
    }
Exemple #8
0
        private void OnSelectListWeapon(DataWeaponParam arg0)
        {
            if (0 < arg0.equip)
            {
                return;
            }


            if (bulk_list.Contains(arg0))
            {
                bulk_list.Remove(arg0);
            }
            else
            {
                bulk_list.Add(arg0);
            }
            foreach (IconInventry icon in main.weapon_list)
            {
                bool bFlag = false;
                foreach (DataWeaponParam w in bulk_list)
                {
                    if (w.serial == icon.m_dataWeapon.serial)
                    {
                        bFlag = true;
                    }
                }
                icon.OnSelect(bFlag);
            }

            int total_price = 0;

            foreach (DataWeaponParam buy in bulk_list)
            {
                DataWeaponParam   data   = DataManager.Instance.dataWeapon.list.Find(p => p.serial == buy.serial);
                MasterWeaponParam master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data.weapon_id);
                total_price += MasterWeapon.GetSellPrice(data, master);
            }
            main.m_txtBulkCoin.text        = total_price.ToString();
            main.m_btnBuyBulk.interactable = 0 < bulk_list.Count;
        }
Exemple #9
0
    public void Initialize(DataWeaponParam _data, MasterWeaponParam _master)
    {
        m_dataWeapon = _data;

        if (_master != null)
        {
            m_goShowRoot.SetActive(true);
            m_goNotInventry.SetActive(false);
            m_imgIcon.sprite = m_spriteAtlas.GetSprite(_master.sprite_name);
            m_goEquip.SetActive(0 < _data.equip);

            if (0 < _data.level)
            {
                m_txtLevel.text = string.Format("+{0}", _data.level);
            }
            else
            {
                m_txtLevel.text = "";
            }
            for (int i = 0; i < star_list.Count; i++)
            {
                star_list[i].sprite = i < _master.rarity ? m_sprStarOn : m_sprStarOff;
            }
        }
        else
        {
            m_goShowRoot.SetActive(false);
            m_goNotInventry.SetActive(true);
        }

        m_btn.onClick.RemoveAllListeners();
        m_btn.onClick.AddListener(() =>
        {
            OnClickWeapon.Invoke(m_dataWeapon);
        });
    }
Exemple #10
0
 public static int GetSellPrice(DataWeaponParam _data, MasterWeaponParam _master)
 {
     return(100 * _master.rarity);
 }
Exemple #11
0
 public static int GetGradeupPrice(DataWeaponParam _data, MasterWeaponParam _master)
 {
     return((_master.rarity * 2) * 100 * (_data.level + 1));
 }
Exemple #12
0
        public override void OnEnter()
        {
            base.OnEnter();

            main.m_btnQuest.onClick.RemoveAllListeners();
            main.m_btnQuest.onClick.AddListener(() =>
            {
                Fsm.Event("quest");
            });

            // charaview
            main.m_charaView.Initialize();

            // weapon
            DataWeaponParam   data_equip   = DataManager.Instance.dataWeapon.list.Find(p => 0 < p.equip);
            MasterWeaponParam master_equip = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data_equip.weapon_id);

            main.m_weaponInfo.Setup(data_equip, master_equip);

            // treasure
            main.m_prefIconTreasure.SetActive(false);
            main.treasure_list.Clear();
            MonoBehaviourEx.DeleteObjects <IconInventry>(main.m_goTreasureRoot);
            for (int i = 0; i < 3; i++)
            {
                IconInventry      icon       = PrefabManager.Instance.MakeScript <IconInventry>(main.m_prefIconTreasure, main.m_goTreasureRoot);
                DataTreasureParam equip_data = DataManager.Instance.dataTreasure.list.Find(p => p.equip == i + 1);
                if (equip_data != null)
                {
                    MasterTreasureParam master = DataManager.Instance.masterTreasure.list.Find(p => p.treasure_id == equip_data.treasure_id);
                    icon.Initialize(equip_data, master);
                }
                else
                {
                    equip_data             = new DataTreasureParam();
                    equip_data.equip       = i + 1;
                    equip_data.treasure_id = 0;
                    icon.Initialize(equip_data, null);
                }
                main.treasure_list.Add(icon);
            }

            // armor
            main.icon_armor_list.Clear();
            main.m_prefIconArmor.SetActive(false);
            MonoBehaviourEx.DeleteObjects <IconArmor>(main.m_goArmorLeft);
            MonoBehaviourEx.DeleteObjects <IconArmor>(main.m_goArmorRight);
            for (int i = 0; i < 4; i++)
            {
                IconArmor script = PrefabManager.Instance.MakeScript <IconArmor>(main.m_prefIconArmor, main.m_goArmorLeft);
                main.icon_armor_list.Add(script);
            }
            for (int i = 0; i < 4; i++)
            {
                IconArmor script = PrefabManager.Instance.MakeScript <IconArmor>(main.m_prefIconArmor, main.m_goArmorRight);
                main.icon_armor_list.Add(script);
            }

            for (int i = 0; i < MasterArmor.ArmorPositionArr.Length; i++)
            {
                DataArmorParam data = DataManager.Instance.dataArmor.list.Find(p => p.position == MasterArmor.ArmorPositionArr[i]);
                main.icon_armor_list[i].Initialize(data, DataManager.Instance.masterArmor.list);
            }
            main.m_panelStage.gameObject.SetActive(false);
            ShowParamsTotal();
            Finish();
        }
Exemple #13
0
        public override void OnEnter()
        {
            base.OnEnter();

            bool bFirstClear = false;

            int floor_id = DataManager.Instance.game_data.ReadInt("floor_id");
            MasterFloorParam current_floor = DataManager.Instance.masterFloor.list.Find(p => p.floor_id == floor_id);
            MasterStageParam current_stage = DataManager.Instance.masterStage.list.Find(p => p.stage_id == current_floor.stage_id);

            DataFloorParam data_floor = DataManager.Instance.dataFloor.list.Find(p => p.floor_id == current_floor.floor_id);

            if (data_floor == null)
            {
                data_floor = new DataFloorParam();
                DataManager.Instance.dataFloor.list.Add(data_floor);
                data_floor.floor_id = floor_id;
            }
            data_floor.count += 1;
            // 初クリア判定は2(クリア状態じゃなければ)
            bFirstClear       = data_floor.status != 2;
            data_floor.status = 2;
            if (DataManager.Instance.IsTest)
            {
                // マジックナンバーか!
                DataManager.Instance.armor_interval = 5;
                DataWeaponParam weapon = DataManager.Instance.dataWeapon.list.Find(p => 0 < p.equip);
                data_floor.test_weapon_id    = weapon.weapon_id;
                data_floor.test_weapon_level = weapon.level;
                DataArmorParam armor = DataManager.Instance.dataArmor.list[0];
                data_floor.test_armor_level = armor.level;
            }

            // 次のフロアが必要な場合
            if (0 < current_floor.next_floor_id)
            {
                DataFloorParam data_next_floor = DataManager.Instance.dataFloor.list.Find(p => p.floor_id == current_floor.next_floor_id);
                if (data_next_floor == null)
                {
                    MasterFloorParam master_next_floor = DataManager.Instance.masterFloor.list.Find(p => p.floor_id == current_floor.next_floor_id);

                    data_next_floor          = new DataFloorParam();
                    data_next_floor.floor_id = master_next_floor.floor_id;
                    data_next_floor.stage_id = master_next_floor.stage_id;
                    data_next_floor.status   = 1;
                    data_next_floor.count    = 0;
                    DataManager.Instance.dataFloor.list.Add(data_next_floor);

                    // ステージが異なる場合はここで追加
                    if (current_floor.stage_id != master_next_floor.stage_id)
                    {
                        DataStageParam data_new_stage = DataManager.Instance.dataStage.list.Find(p => p.stage_id == master_next_floor.stage_id);
                        if (data_new_stage == null)
                        {
                            data_new_stage          = new DataStageParam();
                            data_new_stage.stage_id = master_next_floor.stage_id;
                            data_new_stage.status   = 1;
                            DataManager.Instance.dataStage.list.Add(data_new_stage);
                        }
                    }
                }
            }

            // 現在のフロア攻略チェック
            DataFloorParam check_stage_complete = DataManager.Instance.dataFloor.list.Find(p => p.stage_id == current_floor.stage_id && p.status != 2);

            if (check_stage_complete == null)
            {
                DataStageParam data_current_stage = DataManager.Instance.dataStage.list.Find(p => p.stage_id == current_floor.stage_id);
                data_current_stage.status = 2;
            }

            DataManager.Instance.dataStage.Save();
            DataManager.Instance.dataFloor.Save();
            DataManager.Instance.dataPotion.Save();

            // 獲得Coinの補正
            DataItemParam data_item_coin = DataManager.Instance.dataGetItem.list.Find(p => p.item_id == Defines.ITEM_ID_COIN);
            int           get_coin_num   = 0;

            if (data_item_coin != null)
            {
                get_coin_num = data_item_coin.num;
            }
            get_coin_num = Mathf.CeilToInt((float)get_coin_num * (float)((float)gamemain.player_chara.m_dataUnitParam.coin / 100.0f));

            gamemain.m_goFadePanel.SetActive(true);
            gamemain.m_panelResult.Initialize(floor_id, (int)gamemain.m_fGameTime);
            gamemain.m_panelResult.gameObject.SetActive(true);

            foreach (DataItemParam get in DataManager.Instance.dataGetItem.list)
            {
                if (get.item_id == 1)
                {
                    DataManager.Instance.AddCoin(get.num);
                }
                else if (get.item_id == 2)
                {
                    DataManager.Instance.AddGem(get.num);
                }
                else if (get.item_id == 3)
                {
                    DataManager.Instance.AddKey(get.num);
                }
                else if (get.item_id == 4)
                {
                    DataManager.Instance.AddGoldKey(get.num);
                }
                else
                {
                    DataManager.Instance.dataItem.Add(get.item_id, get.num);
                }
            }
            DataManager.Instance.dataItem.Save();
            DataManager.Instance.dataGetItem.list.Clear();

            DataManager.Instance.user_data.Save();

            gamemain.m_panelResult.m_btnCamp.onClick.RemoveAllListeners();
            gamemain.m_panelResult.m_btnCamp.onClick.AddListener(() =>
            {
                Fsm.Event("camp");
            });
            gamemain.m_panelResult.m_btnRetry.onClick.RemoveAllListeners();
            gamemain.m_panelResult.m_btnRetry.onClick.AddListener(() =>
            {
                Fsm.Event("retry");
            });
            gamemain.m_panelResult.m_btnRetry10.onClick.RemoveAllListeners();
            gamemain.m_panelResult.m_btnRetry10.onClick.AddListener(() =>
            {
                Fsm.Event("retry10");
            });

            gamemain.m_panelResult.m_btnNext.interactable = 0 < current_floor.next_floor_id;
            gamemain.m_panelResult.m_btnNext.onClick.RemoveAllListeners();
            gamemain.m_panelResult.m_btnNext.onClick.AddListener(() =>
            {
                Fsm.Event("next");
            });

            gamemain.m_panelResult.m_btnContinueEnd.onClick.RemoveAllListeners();
            gamemain.m_panelResult.m_btnContinueEnd.onClick.AddListener(() =>
            {
                button_active(true);
                continue_count.Value = 0;
            });
            gamemain.m_panelResult.m_btnQuickNext.onClick.RemoveAllListeners();
            gamemain.m_panelResult.m_btnQuickNext.onClick.AddListener(() =>
            {
                Fsm.Event("retry");
            });

            if (0 < continue_count.Value)
            {
                button_active(false);
                StartCoroutine(auto_retry());
            }
            else
            {
                button_active(true);
            }

            if (DataManager.Instance.IsTest)
            {
                Fsm.Event("retry");
            }
            if (current_floor.next_floor_id == 0 && bFirstClear)
            {
                Fsm.Event("ending");
            }
        }
Exemple #14
0
        public override void OnEnter()
        {
            base.OnEnter();
            // 自動スリープを無効にする場合
            Screen.sleepTimeout = SleepTimeout.NeverSleep;

            gamemain.IsGoal = false;
            gamemain.player_chara.gameObject.SetActive(false);

            if (0 < continue_count.Value)
            {
                gamemain.m_goContinueCountRoot.SetActive(true);
                gamemain.m_txtContinueCount.text = continue_count.Value.ToString();
            }
            else
            {
                gamemain.m_goContinueCountRoot.SetActive(false);
            }


            gamemain.m_fGameTime     = 0.0f;
            gamemain.m_txtFloor.text = string.Format("{0}", "-----");

#if UNITY_EDITOR
            if (DataManager.Instance.IsTest)
            {
                Time.timeScale = DataManager.Instance.TestTimeScale;
                if (DataManager.Instance.test_result == 0)
                {
                    DataManager.Instance.test_floor_id += 1;
                }
                else if (DataManager.Instance.test_result == 1 || 0 < DataManager.Instance.armor_interval)
                {
                    DataManager.Instance.test_weapon_level += 1;
                    if (10 < DataManager.Instance.test_weapon_level)
                    {
                        int[] sword_weapon_id_arr = new int[5]
                        {
                            7, 28, 49, 55, 141
                        };
                        DataManager.Instance.test_weapon_index += 1;
                        DataManager.Instance.test_weapon_id     = sword_weapon_id_arr[DataManager.Instance.test_weapon_index];
                        DataManager.Instance.test_weapon_level  = 1;
                    }
                    DataManager.Instance.armor_interval -= 1;
                }
                else if (DataManager.Instance.test_result == 2)
                {
                    DataManager.Instance.test_armor_level += 1;
                    DataManager.Instance.armor_interval    = 5;
                }
                else
                {
                    Debug.LogError("hairanaihazu");
                }
                DataManager.Instance.game_data.WriteInt("floor_id", DataManager.Instance.test_floor_id);

                DataWeaponParam weapon = DataManager.Instance.dataWeapon.list.Find(p => 0 < p.equip);
                weapon.weapon_id = DataManager.Instance.test_weapon_id;
                weapon.level     = DataManager.Instance.test_weapon_level;

                foreach (DataArmorParam armor in DataManager.Instance.dataArmor.list)
                {
                    MasterArmorParam armor_master      = DataManager.Instance.masterArmor.list.Find(p => p.armor_id == armor.armor_id);
                    MasterArmorParam test_armor_master = DataManager.Instance.masterArmor.list.Find(p =>
                                                                                                    p.position == armor_master.position &&
                                                                                                    p.level == DataManager.Instance.test_armor_level);

                    armor.armor_id = test_armor_master.armor_id;
                    armor.level    = test_armor_master.level;
                }
            }
#endif
            Finish();
        }
Exemple #15
0
        public override void OnEnter()
        {
            base.OnEnter();
            //weapon_serial.Value = 0;

            int iNum = DataManager.Instance.dataWeapon.list.Count;

            main.m_txtListTitle.text = string.Format("所持武器一覧({0}/{1})", iNum, Defines.WEAPON_NUM_LIMIT);
            main.m_goBulkBuyWindow.SetActive(false);

            if (weapon_serial.Value == 0)
            {
                main.m_weaponInfo.Setup(new DataWeaponParam(0, 0), null);
            }
            else
            {
                DataWeaponParam   data   = DataManager.Instance.dataWeapon.list.Find(p => p.serial == weapon_serial.Value);
                MasterWeaponParam master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data.weapon_id);
                main.m_weaponInfo.Setup(data, master);
            }
            main.m_btnList.gameObject.SetActive(false);

            main.m_btnBulk.gameObject.SetActive(true);
            main.m_btnBulk.onClick.AddListener(() =>
            {
                weapon_serial.Value = 0;
                Fsm.Event("bulk");
            });

            main.m_btnBuy.gameObject.SetActive(true);
            main.m_btnBuy.onClick.AddListener(() =>
            {
                Fsm.Event("buy");
            });
            main.m_btnGradeup.gameObject.SetActive(true);
            main.m_btnGradeup.onClick.AddListener(() =>
            {
                DataWeaponParam data     = DataManager.Instance.dataWeapon.list.Find(p => p.serial == weapon_serial.Value);
                MasterWeaponParam master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data.weapon_id);
                DataManager.Instance.UseCoin(MasterWeapon.GetGradeupPrice(data, master));

                data.level += 1;
                main.m_weaponInfo.Setup(data, master);

                foreach (IconInventry icon in main.weapon_list)
                {
                    if (icon.m_dataWeapon.serial == data.serial)
                    {
                        icon.Initialize(data, master);
                        icon.SelectTreasure(data.serial);
                    }
                }

                DataManager.Instance.dataWeapon.Save();
                DataManager.Instance.user_data.Save();
            });

            main.m_btnEquip.gameObject.SetActive(true);
            main.m_btnEquip.interactable = false;
            main.m_btnEquip.onClick.AddListener(() =>
            {
                DataWeaponParam data_equip_pre = DataManager.Instance.dataWeapon.list.Find(p => 0 < p.equip);
                data_equip_pre.equip           = 0;
                DataWeaponParam data_equip     = DataManager.Instance.dataWeapon.list.Find(p => p.serial == weapon_serial.Value);
                data_equip.equip         = 1;
                MasterWeaponParam master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data_equip.weapon_id);

                main.m_weaponInfo.Setup(data_equip, master);

                foreach (IconInventry icon in main.weapon_list)
                {
                    if (icon.m_dataWeapon.serial == data_equip_pre.serial)
                    {
                        icon.m_goEquip.SetActive(false);
                    }
                    if (icon.m_dataWeapon.serial == data_equip.serial)
                    {
                        icon.m_goEquip.SetActive(true);
                    }
                }
                main.m_btnEquip.interactable = false;

                DataManager.Instance.dataWeapon.Save();
            });

            main.m_btnAlbum.gameObject.SetActive(true);
            main.m_btnAlbum.onClick.AddListener(() =>
            {
                Fsm.Event("album");
            });

            main.weapon_list.Clear();
            MonoBehaviourEx.DeleteObjects <IconInventry>(main.m_goListContents);
            foreach (DataWeaponParam data in DataManager.Instance.dataWeapon.list)
            {
                IconInventry icon = PrefabManager.Instance.MakeScript <IconInventry>(
                    main.m_prefIconInventry,
                    main.m_goListContents);
                MasterWeaponParam master = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == data.weapon_id);

                icon.Initialize(data, master);
                main.weapon_list.Add(icon);

                icon.OnClickWeapon.AddListener(OnSelectListWeapon);
            }
            main.SelectListData(weapon_serial.Value);
        }
Exemple #16
0
    IEnumerator init_network()
    {
        Debug.Log("init_network start");
        yield return(StartCoroutine(config.SpreadSheet(Defines.SS_MASTER, "config", () => { })));

        masterChara.SetSaveFilename(Defines.FILENAME_MASTERCHARA);

        masterChara.Load(m_textAssetHolder.Get("master_chara"));
        masterWeapon.Load(m_textAssetHolder.Get("master_weapon"));
        masterArmor.Load(m_textAssetHolder.Get("master_armor"));
        masterSkill.Load(m_textAssetHolder.Get("master_skill"));
        masterPotion.Load(m_textAssetHolder.Get("master_potion"));
        masterTreasure.Load(m_textAssetHolder.Get("master_treasure"));
        masterEnemy.Load(m_textAssetHolder.Get("master_enemy"));
        masterItem.Load(m_textAssetHolder.Get("master_item"));
        masterStage.Load(m_textAssetHolder.Get("master_stage"));
        masterFloor.Load(m_textAssetHolder.Get("master_floor"));
        masterHelp.Load(m_textAssetHolder.Get("master_help"));

#if UNITY_EDITOR
        if (m_bLoadNetworkData)
        {
            #region 通信初期化
            yield return(StartCoroutine(masterChara.SpreadSheet(Defines.SS_MASTER, "chara", () => { })));

            yield return(StartCoroutine(masterWeapon.SpreadSheet(Defines.SS_MASTER, "weapon", () => { })));

            yield return(StartCoroutine(masterArmor.SpreadSheet(Defines.SS_MASTER, "armor", () => { })));

            yield return(StartCoroutine(masterSkill.SpreadSheet(Defines.SS_MASTER, "skill", () => { })));

            yield return(StartCoroutine(masterPotion.SpreadSheet(Defines.SS_MASTER, "potion", () => { })));

            yield return(StartCoroutine(masterTreasure.SpreadSheet(Defines.SS_MASTER, "treasure", () =>
            {
                /*
                 * foreach( MasterTreasureParam master in masterTreasure.list)
                 * {
                 *      Debug.Log(string.Format("id:{0} name:{1} sprite:{2}", master.treasure_id , master.name , master.sprite_name));
                 * }
                 */
            })));

            yield return(StartCoroutine(masterEnemy.SpreadSheet(Defines.SS_MASTER, "enemy", () => { })));

            yield return(StartCoroutine(masterItem.SpreadSheet(Defines.SS_MASTER, "item", () => { })));

            yield return(StartCoroutine(masterStage.SpreadSheet(Defines.SS_MASTER, "stage", () => { })));

            yield return(StartCoroutine(masterFloor.SpreadSheet(Defines.SS_MASTER, "floor", () => { })));

            yield return(StartCoroutine(masterHelp.SpreadSheet(Defines.SS_MASTER, "help", () => { })));

            #endregion
        }
#endif
        // 未初期化扱い
        if (!user_data.HasKey(Defines.KEY_AUTOPOTION_RATE))
        {
            user_data.WriteInt(Defines.KEY_USE_AUTOMOVE, 1);
            user_data.WriteInt(Defines.KEY_USE_AUTOPOTION, 1);

            user_data.WriteFloat(Defines.KEY_AUTOPOTION_RATE, Defines.DEFAULT_AUTOPOTION_RATE);
            user_data.WriteFloat(Defines.KEY_SOUNDVOLUME_BGM, Defines.SOUND_VOLME_DEFAULT);
            user_data.WriteFloat(Defines.KEY_SOUNDVOLUME_SE, Defines.SOUND_VOLME_DEFAULT);
        }


        game_data.SetSaveFilename(Defines.FILENAME_GAMEDATA);
        if (game_data.LoadMulti() == false)
        {
            // なんかする
            // なにもしなくてok
        }
        dataChara.SetSaveFilename(Defines.FILENAME_DATACHARA);
        if (dataChara.LoadMulti() == false)
        {
            // 初期データ的ななにか保存はしない
            DataCharaParam slime = new DataCharaParam();
            slime.chara_id = 1;
            slime.status   = DataChara.STATUS.USING.ToString();
            dataChara.list.Add(slime);
        }
        dataWeapon.SetSaveFilename(Defines.FILENAME_DATAWEAPON);
        if (dataWeapon.LoadMulti() == false)
        {
            DataWeaponParam add_weapon = new DataWeaponParam();
            add_weapon.weapon_id = 1;
            add_weapon.level     = 1;
            add_weapon.equip     = 1;           // 武器はtfで良いのでは?
            dataWeapon.Add(add_weapon);
        }
        dataWeaponAlbum.SetSaveFilename(Defines.FILENAME_DATAWEAPONALBUM);
        if (dataWeaponAlbum.LoadMulti() == false)
        {
            dataWeaponAlbum.AddAlbum(1);
        }


        dataArmor.SetSaveFilename(Defines.FILENAME_DATAARMOR);
        if (dataArmor.LoadMulti() == false)
        {
            for (int i = 0; i < MasterArmor.ArmorPositionArr.Length; i++)
            {
                DataArmorParam add = new DataArmorParam();
                add.position = MasterArmor.ArmorPositionArr[i];
                add.level    = 1;
                MasterArmorParam mas = masterArmor.list.Find(p => p.position == add.position && p.level == add.level);
                add.armor_id = mas.armor_id;
                dataArmor.list.Add(add);
            }
        }
        dataSkill.SetSaveFilename(Defines.FILENAME_DATASKILL);
        if (dataSkill.LoadMulti() == false)
        {
            dataSkill.list.Add(new DataSkillParam(1, 1));
        }
        dataPotion.SetSaveFilename(Defines.FILENAME_DATAPOTION);
        if (dataPotion.LoadMulti() == false)
        {
            DataPotionParam add = new DataPotionParam();
            add.potion_id = 1;
            add.num       = 9;
            add.is_use    = true;
            dataPotion.list.Add(add);
        }

        dataTreasure.SetSaveFilename(Defines.FILENAME_DATATREASURE);
        if (dataTreasure.LoadMulti() == false)
        {
            /*
             * int add_serial = dataTreasure.Add(1001);
             * DataTreasureParam add_treasure = dataTreasure.list.Find(p => p.serial == add_serial);
             * add_treasure.equip = 1;
             */
        }
        dataTreasureAlbum.SetSaveFilename(Defines.FILENAME_DATATREASUREALBUM);
        if (dataTreasureAlbum.LoadMulti() == false)
        {
            /*
             * dataTreasureAlbum.Add(1002);
             * dataTreasureAlbum.Add(1003);
             * dataTreasureAlbum.Add(1006);
             * dataTreasureAlbum.Add(1010);
             * dataTreasureAlbum.Add(1026);
             */
        }

        /*
         * dataScroll.SetSaveFilename(Defines.FILENAME_DATASCROLL);
         * if( dataScroll.LoadMulti()== false)
         * {
         *      dataScroll.list.Add(new DataScrollParam(1, 120));
         *      dataScroll.list.Add(new DataScrollParam(2, 120));
         *      dataScroll.list.Add(new DataScrollParam(3, 120));
         *      dataScroll.list.Add(new DataScrollParam(4, 120));
         *      dataScroll.list.Add(new DataScrollParam(5, 120));
         * }
         */
        dataUnit.SetSaveFilename(Defines.FILENAME_DATAUNIT);
        if (dataUnit.LoadMulti() == false)
        {
        }
        dataItem.SetSaveFilename(Defines.FILENAME_DATAITEM);
        if (dataItem.LoadMulti() == false)
        {
            for (int i = 0; i < 5; i++)
            {
                dataItem.Add(Defines.ITEM_ID_SCROLL_BLUE + i, 0);
            }
        }
        dataGetItem.SetSaveFilename(Defines.FILENAME_DATAITEM_GET);
        if (dataGetItem.LoadMulti() == false)
        {
        }
        dataStage.SetSaveFilename(Defines.FILENAME_DATASTAGE);
        if (dataStage.LoadMulti() == false)
        {
            DataStageParam data = new DataStageParam();
            data.stage_id = 1;
            data.status   = 1;
            dataStage.list.Add(data);
        }
        dataFloor.SetSaveFilename(Defines.FILENAME_DATAFLOOR);
        if (dataFloor.LoadMulti() == false)
        {
            DataFloorParam data = new DataFloorParam();
            data.floor_id = 1;
            data.status   = 1;
            dataFloor.list.Add(data);
        }


        if (m_txtKey != null)
        {
            user_data.AddListenerInt(Defines.KeyKey, (iValue) =>
            {
                m_txtKey.text = iValue.ToString();
            });
            user_data.AddListenerInt(Defines.KeyGoldKey, (iValue) =>
            {
                m_txtGoldKey.text = iValue.ToString();
            });
            user_data.AddListenerInt(Defines.KeyCoin, (iValue) =>
            {
                m_txtCoin.text = iValue.ToString();
            });
            user_data.AddListenerInt(Defines.KeyGem, (iValue) =>
            {
                m_txtGem.text = iValue.ToString();
            });

#if UNITY_EDITOR
            /*
             * AddGem(debug_gem);
             * AddCoin(debug_coin);
             * AddKey(debug_key);
             * AddGoldKey(debug_gold_key);
             */
#endif
            //m_txtKey.text = user_data.ReadInt(Defines.KeyKey).ToString(); ;
            //m_txtGoldKey.text = user_data.Read(Defines.KeyGoldKey);
            //m_txtCoin.text = user_data.Read(Defines.KeyCoin);
            //m_txtGem.text = user_data.Read(Defines.KeyGem);
        }



        Initialized = true;
        Debug.Log("init_network end");
        yield return(null);
    }