示例#1
0
    private void OnBattleStartMessage(NetworkMessage netMsg)
    {
        netMsg.reader.SeekZero();
        BattleStartMessage msg    = netMsg.ReadMessage <BattleStartMessage>();
        PokemonModel       pModel = PublicDataManager.instance.GetPokemonModel(msg.pokemonId);

        Debug.Log("Opp Pokemon" + pModel.name_ch);
        pModel.attack     = msg.attackAv;
        pModel.defense    = msg.defenceAv;
        pModel.hp         = msg.hpAv;
        pModel.sp_attack  = msg.sp_attackAv;
        pModel.sp_defense = msg.sp_defenceAv;
        pModel.speed      = msg.speedAv;
        CharacterModel   cModel   = PublicDataManager.instance.GetCharacterModel(msg.charavterId);
        PersonalityModel perModel = PublicDataManager.instance.GetPersonalityModel(msg.personalityId);
        ItemModel        iModel   = PublicDataManager.instance.GetItemModel(msg.itemId);

        SkillModel[] sModel = new SkillModel[4];
        for (int i = 0; i < msg.skillIds.Length; i++)
        {
            sModel[i] = PublicDataManager.instance.GetSkillModel(msg.skillIds[i]);
        }
        Pokemon p = new Pokemon(pModel, cModel, perModel, iModel, sModel);

        RuntimeData.SetCurrentOppIndex(msg.index);
        RuntimeData.SetCurrentOppPokemon(p);
        if (RuntimeData.IsOppPokemonsFull())
        {
            UIManager.instance.ClosePage(PageCollection.StartPage);
            UIManager.instance.OpenPage(PageCollection.BattlePage);
        }
    }
示例#2
0
 private void OnClickCreatBtn()
 {
     if (!RuntimeData.IsMyPokemonsFull())
     {
         return;
     }
     RuntimeData.SetCurrentMyIndex(0);
     RuntimeData.SetCurrentOppIndex(0);
     PNetworkManager.LanGame(0);
 }