Ejemplo n.º 1
0
        public override void OnEnter()
        {
            base.OnEnter();

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

            main.m_txtListTitle.text = string.Format("武器アルバム({0}/{1})", iNum, DataManager.Instance.masterWeapon.list.Count);

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

            main.m_btnList.gameObject.SetActive(true);
            main.m_btnList.onClick.AddListener(() =>
            {
                Finish();
            });

            main.weapon_list.Clear();
            MonoBehaviourEx.DeleteObjects <IconInventry>(main.m_goListContents);
            foreach (DataWeaponParam data in DataManager.Instance.dataWeaponAlbum.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);
            }
        }
Ejemplo n.º 2
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");
            });
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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));
    }
Ejemplo n.º 5
0
 public void Initialize(DataUnitParam _data, MasterSkillParam _skill, string _target_tag, MasterWeaponParam _weapon)
 {
     m_data         = _data;
     m_skill        = _skill;
     m_strTargetTag = _target_tag;
     m_weapon       = _weapon;
     Destroy(gameObject, 0.5f);
 }
Ejemplo n.º 6
0
    public void Damage(DataUnitParam _attack, MasterSkillParam _skill, MasterWeaponParam _weapon)
    {
        int damage = _attack.CalcDamage(dataUnitParam, _skill, _weapon);

        dataUnitParam.hp -= damage;

        DamageNum script = PrefabManager.Instance.MakeScript <DamageNum>(GameMain.Instance.m_prefDamageNum, m_enemyBody.gameObject);

        script.Initialize(damage, true);
        script.transform.parent = script.transform.parent.parent.parent;
    }
Ejemplo n.º 7
0
    public int CalcDamage(DataUnitParam _target, MasterSkillParam _skill, MasterWeaponParam _weapon)
    {
        int use_attack = attack;

        if (_weapon != null)
        {
            //Debug.Log(_weapon.weapon_type);
            if (_weapon.weapon_type == "hammer")
            {
                use_attack /= 2;
            }
            else if (_weapon.weapon_type == "dagger")
            {
                use_attack = use_attack + use_attack / 2;
            }
            else
            {
            }
        }
        //Debug.Log(string.Format("{0}:{1}", attack, use_attack));

        float base_damage = (use_attack * 3 - _target.def) * 0.717f;

        //Debug.Log(base_damage);

        if (base_damage < 1.0f)
        {
            base_damage = 1.0f;
        }

        float skill_rate = 1.0f;

        if (_skill != null)
        {
            skill_rate = _skill.param * 0.01f;
        }

        float[] rand_rate_table = { 0.98f, 0.99f, 1.00f, 1.01f, 1.02f };
        //int[] rand_add_table = { 0,1,2,3,4 };
        int[] rand_add_table = { 0, 1, 1, 2, 2 };

        int index_rand_rate = UtilRand.GetRand(rand_rate_table.Length);
        int index_rand_add  = UtilRand.GetRand(rand_add_table.Length);

        float fRet = (base_damage * skill_rate * rand_rate_table[index_rand_rate]) + rand_add_table[index_rand_add];

        if (fRet < 1.0f)
        {
            fRet = 1.0f;
        }
        return((int)fRet);
    }
Ejemplo n.º 8
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;
        }
Ejemplo n.º 9
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();
            });
        }
Ejemplo n.º 10
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  = "---";
        }
    }
Ejemplo n.º 11
0
    public MasterWeaponParam GetParam(int _iLevel)
    {
        MasterWeaponParam ret = new MasterWeaponParam();

        ret.weapon_id    = weapon_id;
        ret.name         = name;
        ret.rarity       = rarity;
        ret.attack       = attack + (int)((float)attack * ((float)_iLevel / 5.0f));
        ret.speed        = speed + (int)((float)speed * ((float)_iLevel / 50.0f));
        ret.ability_id   = ability_id;
        ret.ability_rate = ability_rate;
        ret.sprite_name  = sprite_name;

        return(ret);
    }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
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;
        }
Ejemplo n.º 14
0
    public bool AddAlbum(int _iWeaponId)
    {
        DataWeaponParam check_exist = list.Find(p => p.weapon_id == _iWeaponId);

        if (check_exist != null)
        {
            return(false);
        }

        MasterWeaponParam master_exist = DataManager.Instance.masterWeapon.list.Find(p => p.weapon_id == _iWeaponId);

        if (master_exist == null)
        {
            // そもそもない
            return(false);
        }

        // シリアルは使わない
        DataWeaponParam add = new DataWeaponParam(0, _iWeaponId);

        list.Add(add);
        return(true);
    }
Ejemplo n.º 15
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);
        });
    }
Ejemplo n.º 16
0
        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);
            });
        }
Ejemplo n.º 17
0
        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();
        }
Ejemplo n.º 18
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);
        }
Ejemplo n.º 19
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();
        }