コード例 #1
0
        private IEnumerator exe_main()
        {
            yield return(new WaitForSeconds(0.5f));

            battleMain.enemy_card = PrefabManager.Instance.MakeScript <Card>(
                battleMain.m_prefCard, battleMain.m_goEnemyCardRoot);

            //Debug.Log(battleMain.dataCardEnemy.list.Count);
            if (battleMain.dataCardEnemy.CardFill(2) == false)
            {
                battleMain.dataCardEnemy.DeckShuffle();
                if (battleMain.dataCardEnemy.CardFill(2) == false)
                {
                    Debug.LogError("warning enemy deck");
                }
            }

            DataCardParam select_enemy_card = battleMain.dataCardEnemy.RandomSelectFromHand();

            select_enemy_card.status = (int)DataCard.STATUS.PLAY;
            enemy_card_id.Value      = select_enemy_card.card_id;
            enemy_card_serial.Value  = select_enemy_card.card_serial;
            //MasterCardParam master_enemy_card = DataManagerGame.Instance.masterCard.list.Find(p => p.card_id == enemy_card_id.Value);
            battleMain.enemy_card.Initialize(select_enemy_card, DataManagerGame.Instance.masterCardSymbol.list);

            Finish();
        }
コード例 #2
0
    public void Show(DataUnitParam _dataChara, MasterCharaParam _masterChara, List <MasterCardParam> _master_card_list, List <MasterCharaCardParam> _chara_card_list, List <MasterCardSymbolParam> _symbol_list)
    {
        m_imgIcon.sprite    = SpriteManager.Instance.Get(string.Format(Defines.STR_FORMAT_FACEICON, _masterChara.chara_id));
        m_txtCharaName.text = _masterChara.name;
        m_txtHP.text        = _dataChara.hp_max.ToString();
        m_txtSTR.text       = _dataChara.str.ToString();
        m_txtMAG.text       = _dataChara.magic.ToString();
        m_txtHEAL.text      = _dataChara.heal.ToString();
        m_txtFood.text      = _dataChara.food.ToString();

        m_barTension.SetValueCurrent(_dataChara.tension);

        Card[] arr = m_goCardRoot.GetComponentsInChildren <Card>();
        foreach (Card c in arr)
        {
            GameObject.Destroy(c.gameObject);
        }

        foreach (MasterCharaCardParam p in _chara_card_list.FindAll(p => p.chara_id == _masterChara.chara_id))
        {
            //Debug.Log(p.card_id);
            Card c = PrefabManager.Instance.MakeScript <Card>(m_prefCard, m_goCardRoot);

            DataCardParam data_card = new DataCardParam();

            data_card.Copy(_master_card_list.Find(a => a.card_id == p.card_id), _masterChara.chara_id, 0);
            c.Initialize(data_card, _symbol_list);
        }
    }
コード例 #3
0
    public void card_initialize()
    {
        // 初期設定
        dataCard.list.Clear();

        int serial = 1;

        List <DataUnitParam> unit_param_list = dataUnit.list.FindAll(p => p.unit == "chara" && (p.position == "left" || p.position == "right" || p.position == "back"));

        foreach (DataUnitParam unit in unit_param_list)
        {
            List <MasterCharaCardParam> card_list = masterCharaCard.list.FindAll(p => p.chara_id == unit.chara_id);
            foreach (MasterCharaCardParam c in card_list)
            {
                DataCardParam dc = new DataCardParam();

                //dc.chara_id = c.chara_id;
                //dc.card_id = c.card_id;
                //dc.card_serial = serial;
                dc.Copy(masterCard.list.Find(p => p.card_id == c.card_id), c.chara_id, serial);

                dc.status = (int)DataCard.STATUS.DECK;
                if (unit.position == "back")
                {
                    dc.status = (int)DataCard.STATUS.NOTUSE;
                }
                serial += 1;
                dataCard.list.Add(dc);
            }
        }

        Debug.LogWarning(dataCard.list.Count);

        dataCard.CardFill(5);
    }
コード例 #4
0
    public void CardAdd(DataCardParam _data)
    {
        Card c = PrefabManager.Instance.MakeScript <Card>(m_prefCard, m_goCardRoot);

        c.Initialize(_data, DataManagerGame.Instance.masterCardSymbol.list);

        card_list_hand.Add(c);
    }
コード例 #5
0
        public override void OnEnter()
        {
            base.OnEnter();

            DataCardParam player_card = simulator.dataCard.list.Find(p => p.card_serial == player_card_serial.Value);
            DataCardParam enemy_card  = simulator.dataCardEnemy.list.Find(p => p.card_serial == enemy_card_serial.Value);

            player_card.status = (int)DataCard.STATUS.REMOVE;

            card_play_count.Value += 1;
            mp.Value += player_card.power;
            if (30 < mp.Value)
            {
                mp.Value = 30;
            }
            DataCard.Offset(player_card, enemy_card);

            DataUnitParam player_unit = simulator.dataUnit.list.Find(p => p.chara_id == player_card.chara_id && p.unit == "chara");
            DataUnitParam enemy_unit  = simulator.dataUnit.list.Find(p => p.unit == "enemy");

            player_unit.Attack_Sim(player_unit.str, 1001, player_card, enemy_unit);

            if (enemy_unit.hp <= 0)
            {
                Fsm.Event("win");
                return;
            }
            else
            {
                enemy_unit.Attack_Sim(enemy_unit.str, 1001, enemy_card, player_unit);
            }

            if (player_unit.hp <= 0)
            {
                Fsm.Event("dead");
                return;
            }

            player_unit.Attack_Sim(player_unit.magic, 3001, player_card, enemy_unit);

            if (enemy_unit.hp <= 0)
            {
                Fsm.Event("win");
                return;
            }
            else
            {
                enemy_unit.Attack_Sim(enemy_unit.magic, 3001, enemy_card, player_unit);
            }

            if (player_unit.hp <= 0)
            {
                Fsm.Event("dead");
                return;
            }

            Finish();
        }
コード例 #6
0
    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);
        }
    }
コード例 #7
0
 public void Attack_Sim(int _iAttack, int _iSymbolId, DataCardParam _card, DataUnitParam _target)
 {
     for (int i = 0; i < 6; i++)
     {
         if (_card.GetSymbolId(i) == _iSymbolId)
         {
             _target.hp -= _iAttack;
         }
     }
     return;
 }
コード例 #8
0
 void on_select_card(DataCardParam arg0)
 {
     // 選ばれたカードおシリアル番号を入力
     if (card_serial.Value == arg0.card_serial)
     {
         Fsm.Event("decide");
     }
     else
     {
         card_serial.Value = arg0.card_serial;
         Fsm.Event("other");
     }
 }
コード例 #9
0
        public override void OnEnter()
        {
            base.OnEnter();
            DataCardParam player_card = simulator.dataCard.list.Find(p => p.card_serial == player_card_serial.Value);

            Debug.Log(player_card.chara_id);
            DataUnitParam battle_chara = simulator.dataUnit.list.Find(p => p.chara_id == player_card.chara_id && p.unit == "chara");

            List <DataUnitParam> back_chara_list = simulator.dataUnit.list.FindAll(p => p.unit == "chara" && p.position == "back");

            bool bChangeMember = false;

            foreach (DataUnitParam back_unit in back_chara_list)
            {
                // 選手交代
                if (0 < back_unit.hp)
                {
                    back_unit.position    = battle_chara.position;
                    battle_chara.position = "back";
                    foreach (DataCardParam card in simulator.dataCard.list.FindAll(p => p.chara_id == back_unit.chara_id))
                    {
                        card.status = (int)DataCard.STATUS.REMOVE;
                    }
                    bChangeMember = true;
                }
            }
            if (bChangeMember)
            {
                Debug.Log("メンバー交代");
                //GameMain.Instance.panelStatus.Initialize(simulator.dataUnit, simulator.masterChara);
            }
            else
            {
            }

            foreach (DataCardParam card in simulator.dataCard.list.FindAll(p => p.chara_id == battle_chara.chara_id))
            {
                card.status = (int)DataCard.STATUS.NOTUSE;
            }

            if (simulator.dataUnit.IsAliveParty())
            {
                //Fsm.Event("dead");
                Finish();
            }
            else
            {
                Fsm.Event("gameover");
            }
        }
コード例 #10
0
        public override void OnEnter()
        {
            base.OnEnter();
            if (simulator.dataCardEnemy.CardFill(2) == false)
            {
                simulator.dataCardEnemy.DeckShuffle();
                if (simulator.dataCardEnemy.CardFill(2) == false)
                {
                    Debug.LogError("warning enemy deck");
                }
            }
            DataCardParam select_enemy_card = simulator.dataCardEnemy.RandomSelectFromHand();

            select_enemy_card.status = (int)DataCard.STATUS.REMOVE;
            enemy_card_id.Value      = select_enemy_card.card_id;
            enemy_card_serial.Value  = select_enemy_card.card_serial;
            Finish();
        }
コード例 #11
0
        public override void OnEnter()
        {
            base.OnEnter();
            if (battleMain.player_card != null)
            {
                GameObject.Destroy(battleMain.player_card.gameObject);
                battleMain.player_card = null;
            }

            battleMain.player_card = PrefabManager.Instance.MakeScript <Card>(
                battleMain.m_prefCard, battleMain.m_goPlayerCardRoot);

            DataCardParam data_card = DataManagerGame.Instance.dataCard.list.Find(p => p.card_serial == select_card_serial.Value);

            battleMain.player_card.Initialize(data_card, DataManagerGame.Instance.masterCardSymbol.list);

            Finish();
        }
コード例 #12
0
        private void OnClickCard(int arg0)
        {
            bool notexist = true;

            foreach (Card dc in GameMain.Instance.card_list_hand)
            {
                if (dc.data_card.card_serial == arg0)
                {
                    notexist = false;
                }
            }
            if (notexist)
            {
                Debug.Log(arg0);
                foreach (Card dc in GameMain.Instance.card_list_hand)
                {
                    Debug.Log(dc.data_card.card_serial);
                }
            }

            if (select_card_serial.Value == arg0)
            {
                Fsm.Event("select");
                Card selected_card = battleMain.gameMain.card_list_hand.Find(p => p.data_card.card_serial == select_card_serial.Value);

                select_chara_id.Value = selected_card.data_card.chara_id;

                selected_card.data_card.status = (int)DataCard.STATUS.PLAY;
                selected_card.m_animator.SetBool("delete", true);
                battleMain.gameMain.card_list_hand.Remove(selected_card);
                battleMain.gameMain.CardOrder();
            }
            else
            {
                select_card_serial.Value = arg0;
                battleMain.gameMain.CardSelectUp(select_card_serial.Value);
                DataCardParam card = DataManagerGame.Instance.dataCard.list.Find(p => p.card_serial == select_card_serial.Value);

                battleMain.gameMain.SelectCharaId = card.chara_id;
                battleMain.HpRefresh();

                Fsm.Event("touch");
            }
        }
コード例 #13
0
        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();
        }
コード例 #14
0
        public override void OnEnter()
        {
            base.OnEnter();

            DataCardParam   data_enemy_card   = simulator.dataCardEnemy.list.Find(p => p.card_serial == enemy_card_serial.Value);
            MasterCardParam master_enemy_card = simulator.masterCard.list.Find(p => p.card_id == enemy_card_id.Value);

            int iSerialPlayerCard = simulator.dataCard.SelectBattleCard_FromHand(
                master_enemy_card,
                simulator.masterCard.list,
                simulator.masterCardSymbol.list);

            if (iSerialPlayerCard == 0)
            {
                iSerialPlayerCard = simulator.dataCard.RandomSelectFromHand().card_serial;
            }

            player_card_serial.Value = iSerialPlayerCard;

            Finish();
        }
コード例 #15
0
        private void create_enemy(int _enemy_chara_id)
        {
            simulator.dataUnit.list.RemoveAll(p => p.unit == "enemy");
            MasterCharaParam master_enemy = simulator.masterChara.list.Find(p => p.chara_id == _enemy_chara_id);
            DataUnitParam    enemy        = DataUnit.MakeUnit(master_enemy, 1, "enemy", 60);

            simulator.dataUnit.list.Add(enemy);

            //Debug.LogError(_enemy_chara_id);

            simulator.dataCardEnemy.list.Clear();
            int iSerial = 1;

            foreach (MasterCharaCardParam cc in simulator.masterCharaCard.list.FindAll(p => p.chara_id == _enemy_chara_id))
            {
                DataCardParam   add         = new DataCardParam();
                MasterCardParam master_card = simulator.masterCard.list.Find(p => p.card_id == cc.card_id);
                add.Copy(master_card, _enemy_chara_id, iSerial);
                simulator.dataCardEnemy.list.Add(add);
                iSerial += 1;
            }
        }
コード例 #16
0
        public override void OnUpdate()
        {
            base.OnUpdate();

            #region Aging
            if (DataManagerGame.Instance.IsAging)
            {
                aging_timer += Time.deltaTime;
                if (3.0f < aging_timer)
                {
                    if (0 == select_card_serial.Value)
                    {
                        //int index = UtilRand.GetRand(battleMain.gameMain.card_list_hand.Count);

                        // シミュレーターから持ってきた
                        DataCardParam   data_enemy_card   = battleMain.dataCardEnemy.list.Find(p => p.card_serial == enemy_card_serial.Value);
                        MasterCardParam master_enemy_card = DataManagerGame.Instance.masterCard.list.Find(p => p.card_id == enemy_card_id.Value);


                        int iSerialPlayerCard = DataManagerGame.Instance.dataCard.SelectBattleCard_FromHand(
                            master_enemy_card,
                            DataManagerGame.Instance.masterCard.list,
                            DataManagerGame.Instance.masterCardSymbol.list);

                        if (iSerialPlayerCard == 0)
                        {
                            iSerialPlayerCard = DataManagerGame.Instance.dataCard.RandomSelectFromHand().card_serial;
                        }

                        OnClickCard(iSerialPlayerCard);
                    }
                    else
                    {
                        OnClickCard(select_card_serial.Value);
                    }
                }
            }
            #endregion
        }
コード例 #17
0
        public override void OnEnter()
        {
            base.OnEnter();

            if (select_card_serial.Value != 0)
            {
                DataCardParam card       = DataManagerGame.Instance.dataCard.list.Find(p => p.card_serial == select_card_serial.Value);
                DataUnitParam play_chara = DataManagerGame.Instance.dataUnit.list.Find(p => p.chara_id == card.chara_id && p.unit == "chara" && 0 < p.hp);

                //Debug.Log((DataCard.STATUS)card.status);
                //Debug.Log(play_chara);
                if (play_chara != null)
                {
                    card.status = (int)DataCard.STATUS.REMOVE;
                }
                else
                {
                    if (card.status != (int)DataCard.STATUS.NOTUSE)
                    {
                        card.status = (int)DataCard.STATUS.NOTUSE;
                    }
                }
            }
            if (enemy_card_serial.Value != 0)
            {
                DataCardParam select_enemy_card = battleMain.dataCardEnemy.list.Find(p => p.card_serial == enemy_card_serial.Value);
                select_enemy_card.status = (int)DataCard.STATUS.REMOVE;
            }

            if (is_win.Value)
            {
                Fsm.Event("win");
            }
            else
            {
                Finish();
            }
        }
コード例 #18
0
        private IEnumerator move_wait()
        {
            simulator.move_delay += 1;
            if (200 < simulator.move_delay)
            {
                simulator.move_delay = 0;
                yield return(null);
            }


            DataCardParam select_card = simulator.dataCard.RandomSelectFromHand();

            DataCorridorParam current_corridor = simulator.dataCorridor.list.Find(p => p.index == current_index.Value);

            card_play_count.Value += 1;
            mp.Value += select_card.power;
            if (30 < mp.Value)
            {
                mp.Value = 30;
            }
            for (int i = 0; i < select_card.power; i++)
            {
                current_index.Value = current_corridor.next_index;
                current_corridor    = simulator.dataCorridor.list.Find(p => p.index == current_index.Value);

                if (current_corridor.corridor_event.corridor_event_id == 2)
                {
                    // ここダサすぎる
                    break;
                }
            }

            select_card.status  = (int)DataCard.STATUS.REMOVE;
            corridor_type.Value = current_corridor.corridor_event.corridor_type;
            Fsm.Event(current_corridor.corridor_event.corridor_type);
        }
コード例 #19
0
        public override void OnEnter()
        {
            base.OnEnter();

            battleMain.Opening();

            battleMain.m_animChara.Play("idle");
            battleMain.m_animEnemy.Play("idle");


            if (battleMain.player_card != null)
            {
                GameObject.Destroy(battleMain.player_card.gameObject);
                battleMain.player_card = null;
            }
            if (battleMain.enemy_card != null)
            {
                GameObject.Destroy(battleMain.enemy_card.gameObject);
                battleMain.enemy_card = null;
            }
            battleMain.dataCardEnemy.list.Clear();

            BattleIcon[] arr = battleMain.m_goBattleChara.GetComponentsInChildren <BattleIcon>();
            foreach (BattleIcon c in arr)
            {
                GameObject.Destroy(c.gameObject);
            }
            arr = battleMain.m_goBattleEnemy.GetComponentsInChildren <BattleIcon>();
            foreach (BattleIcon c in arr)
            {
                GameObject.Destroy(c.gameObject);
            }

            // 敵のデッキデータ
            //Debug.LogWarning(DataManagerGame.Instance.masterCharaCard.list.FindAll(p => p.chara_id == enemy_chara_id.Value).Count);


            MasterCharaParam master_enemy = DataManagerGame.Instance.masterChara.list.Find(p => p.chara_id == enemy_chara_id.Value);

            battleMain.dataCardEnemy.SetSaveFilename(Defines.FILENAME_CARD_ENEMY);


            if (0 == DataManagerGame.Instance.gameData.ReadInt(Defines.KEY_GAME_BATTLE_ENEMY_ID))
            {
                // 敵は1体消して新規に追加
                DataManagerGame.Instance.dataUnit.list.RemoveAll(p => p.unit == "enemy");

                // 敵にこっそりテンションを入れるならここ
                DataUnitParam enemy = DataUnit.MakeUnit(master_enemy, 1, "enemy", 60);
                DataManagerGame.Instance.dataUnit.list.Add(enemy);

                DataManagerGame.Instance.gameData.WriteInt(Defines.KEY_GAME_BATTLE_ENEMY_ID, enemy_chara_id.Value);

                int iSerial = 1;
                foreach (MasterCharaCardParam cc in DataManagerGame.Instance.masterCharaCard.list.FindAll(p => p.chara_id == enemy_chara_id.Value))
                {
                    DataCardParam   add         = new DataCardParam();
                    MasterCardParam master_card = DataManagerGame.Instance.masterCard.list.Find(p => p.card_id == cc.card_id);
                    add.Copy(master_card, enemy_chara_id.Value, iSerial);
                    battleMain.dataCardEnemy.list.Add(add);
                    iSerial += 1;
                }
            }
            else
            {
                Debug.Log("battle resume");
                enemy_chara_id.Value = DataManagerGame.Instance.gameData.ReadInt(Defines.KEY_GAME_BATTLE_ENEMY_ID);
                master_enemy         = DataManagerGame.Instance.masterChara.list.Find(p => p.chara_id == enemy_chara_id.Value);

                battleMain.dataCardEnemy.LoadMulti();
            }


            battleMain.m_sprEnemy.sprite = SpriteManager.Instance.Get(master_enemy.sprite_name);
            battleMain.HpRefresh();


            battleMain.OnOpeningEnd.AddListener(() =>
            {
                battleMain.OnOpeningEnd.RemoveAllListeners();
                if (is_boss.Value)
                {
                    BGMControl.Instance.Play(Defines.BGM_NAME_BOSS);
                }
                else
                {
                    BGMControl.Instance.Play(Defines.BGM_NAME_BATTLE);
                }
                Finish();
            });
        }
コード例 #20
0
 void on_select_card(DataCardParam arg0)
 {
     // 選ばれたカードおシリアル番号を入力
     card_serial.Value = arg0.card_serial;
     Fsm.Event("select");
 }
コード例 #21
0
 public void Initialize(MasterCardParam _master_card, List <MasterCardSymbolParam> _master_card_symbol_list)
 {
     data_card = new DataCardParam();
     data_card.Copy(_master_card, 0, 0);
     _initialize(_master_card_symbol_list);
 }
コード例 #22
0
 public void Initialize(DataCardParam _card, List <MasterCardSymbolParam> _master_card_symbol_list)
 {
     data_card = _card;
     _initialize(_master_card_symbol_list);
 }