public static PlayerLoadInfo FromCharaInfo(CharaInfo chara_info, bool need_weapon, bool need_helm, bool need_leg, bool is_priority_visual_equip)
    {
        PlayerLoadInfo playerLoadInfo = new PlayerLoadInfo();

        playerLoadInfo.Apply(chara_info, need_weapon, need_helm, need_leg, is_priority_visual_equip);
        return(playerLoadInfo);
    }
    private static PlayerLoader Load(HomePlayerCharacter chara, GameObject go, FriendCharaInfo chara_info, PlayerLoader.OnCompleteLoad callback)
    {
        PlayerLoader   playerLoader   = go.AddComponent <PlayerLoader>();
        PlayerLoadInfo playerLoadInfo = new PlayerLoadInfo();

        if (chara_info != null)
        {
            playerLoadInfo.Apply(chara_info, false, true, true, true);
            chara.sexType = chara_info.sex;
        }
        else
        {
            int num = Random.Range(0, 2);
            int face_type_id;
            int hair_style_id;
            if (num == 0)
            {
                int[] defaultHasManFaceIndexes = Singleton <AvatarTable> .I.defaultHasManFaceIndexes;
                face_type_id = defaultHasManFaceIndexes[Random.Range(0, defaultHasManFaceIndexes.Length)];
                int[] defaultHasManHeadIndexes = Singleton <AvatarTable> .I.defaultHasManHeadIndexes;
                hair_style_id = defaultHasManHeadIndexes[Random.Range(0, defaultHasManHeadIndexes.Length)];
            }
            else
            {
                int[] defaultHasWomanFaceIndexes = Singleton <AvatarTable> .I.defaultHasWomanFaceIndexes;
                face_type_id = defaultHasWomanFaceIndexes[Random.Range(0, defaultHasWomanFaceIndexes.Length)];
                int[] defaultHasWomanHeadIndexes = Singleton <AvatarTable> .I.defaultHasWomanHeadIndexes;
                hair_style_id = defaultHasWomanHeadIndexes[Random.Range(0, defaultHasWomanHeadIndexes.Length)];
            }
            int[] defaultHasSkinColorIndexes = Singleton <AvatarTable> .I.defaultHasSkinColorIndexes;
            int   skin_color_id = defaultHasSkinColorIndexes[Random.Range(0, defaultHasSkinColorIndexes.Length)];
            int[] defaultHasHairColorIndexes = Singleton <AvatarTable> .I.defaultHasHairColorIndexes;
            int   hair_color_id = defaultHasHairColorIndexes[Random.Range(0, defaultHasHairColorIndexes.Length)];
            playerLoadInfo.SetFace(num, face_type_id, skin_color_id);
            playerLoadInfo.SetHair(num, hair_style_id, hair_color_id);
            OutGameSettingsManager.HomeScene.RandomEquip randomEquip = MonoBehaviourSingleton <OutGameSettingsManager> .I.homeScene.randomEquip;
            uint equip_body_item_id = (uint)Utility.Lot(randomEquip.bodys);
            uint equip_head_item_id = (uint)Utility.Lot(randomEquip.helms);
            uint equip_arm_item_id  = (uint)Utility.Lot(randomEquip.arms);
            uint equip_leg_item_id  = (uint)Utility.Lot(randomEquip.legs);
            playerLoadInfo.SetEquipBody(num, equip_body_item_id);
            if (Random.Range(0, 4) != 0)
            {
                playerLoadInfo.SetEquipHead(num, equip_head_item_id);
            }
            playerLoadInfo.SetEquipArm(num, equip_arm_item_id);
            playerLoadInfo.SetEquipLeg(num, equip_leg_item_id);
            chara.sexType = num;
        }
        playerLoader.StartLoad(playerLoadInfo, 0, 99, false, false, true, true, false, false, true, true, SHADER_TYPE.NORMAL, callback, true, -1);
        return(playerLoader);
    }
    private PlayerLoader Load(LoungePlayer chara, GameObject go, CharaInfo chara_info, PlayerLoader.OnCompleteLoad callback)
    {
        PlayerLoader   playerLoader   = go.AddComponent <PlayerLoader>();
        PlayerLoadInfo playerLoadInfo = new PlayerLoadInfo();

        if (chara_info != null)
        {
            playerLoadInfo.Apply(chara_info, false, true, true, true);
            chara.sexType = chara_info.sex;
        }
        playerLoader.StartLoad(playerLoadInfo, 8, 99, false, false, true, true, false, false, true, true, SHADER_TYPE.NORMAL, callback, true, -1);
        return(playerLoader);
    }
    private IEnumerator Loading()
    {
        renderTexture.enableTexture = false;
        if (userInfo != null && userIndex >= 0)
        {
            bool is_owner = userInfo.userId == MonoBehaviourSingleton <PartyManager> .I.GetOwnerUserId();

            foreach (Transform item in model)
            {
                Transform t = item;
                Object.Destroy(t.get_gameObject());
            }
            PlayerLoadInfo load_info = new PlayerLoadInfo();
            load_info.Apply(userInfo, true, true, true, true);
            bool wait = true;
            loader = model.get_gameObject().AddComponent <PlayerLoader>();
            loader.StartLoad(load_info, renderTexture.renderLayer, 90, false, false, false, false, false, false, true, true, SHADER_TYPE.UI, delegate
            {
                //IL_004b: Unknown result type (might be due to invalid IL or missing references)
                //IL_005b: Unknown result type (might be due to invalid IL or missing references)
                //IL_0060: Unknown result type (might be due to invalid IL or missing references)
                //IL_0068: Unknown result type (might be due to invalid IL or missing references)
                //IL_006d: Unknown result type (might be due to invalid IL or missing references)
                ((_003CLoading_003Ec__Iterator105) /*Error near IL_0168: stateMachine*/)._003Cwait_003E__4 = false;
                float num = (((_003CLoading_003Ec__Iterator105) /*Error near IL_0168: stateMachine*/)._003C_003Ef__this.userInfo.sex != 0) ? MonoBehaviourSingleton <OutGameSettingsManager> .I.statusScene.playerScaleFemale : MonoBehaviourSingleton <OutGameSettingsManager> .I.statusScene.playerScaleMale;
                ((_003CLoading_003Ec__Iterator105) /*Error near IL_0168: stateMachine*/)._003C_003Ef__this.loader.get_transform().set_localScale(((_003CLoading_003Ec__Iterator105) /*Error near IL_0168: stateMachine*/)._003C_003Ef__this.loader.get_transform().get_localScale().Mul(new Vector3(num, num, num)));
            }, true, -1);
            int voice_id = -1;
            if (!is_owner)
            {
                voice_id = loader.GetVoiceId(ACTION_VOICE_EX_ID.ALLIVE_01);
                LoadingQueue lo_queue = new LoadingQueue(this);
                lo_queue.CacheActionVoice(voice_id, null);
                while (lo_queue.IsLoading())
                {
                    yield return((object)null);
                }
            }
            while (wait)
            {
                yield return((object)null);
            }
            animCtrl = PlayerAnimCtrl.Get(loader.animator, PlayerAnimCtrl.battleAnims[load_info.weaponModelID / 1000], null, OnAnimChange, OnAnimEnd);
            renderTexture.enableTexture = true;
            if (voice_id > 0)
            {
                SoundManager.PlayActionVoice(voice_id, 1f, 0u, null, null);
            }
        }
    }
Exemple #5
0
    public Player CreatePlayer(int id, CreatePlayerInfo create_info, bool self, Vector3 pos, float dir, PlayerTransferInfo transfer_info = null, PlayerLoader.OnCompleteLoad callback = null)
    {
        //IL_001d: Unknown result type (might be due to invalid IL or missing references)
        //IL_0022: Expected O, but got Unknown
        //IL_003a: Unknown result type (might be due to invalid IL or missing references)
        //IL_010a: Unknown result type (might be due to invalid IL or missing references)
        //IL_0123: Unknown result type (might be due to invalid IL or missing references)
        //IL_01c9: Unknown result type (might be due to invalid IL or missing references)
        if (create_info.charaInfo == null)
        {
            Log.Error("StageObjectManager.CreatePlayer() charaInfo is NULL");
            return(null);
        }
        GameObject val = new GameObject();

        val.set_name("Player:" + id);
        val.get_transform().set_parent(base._transform);
        int num = 0;

        if (create_info.extentionInfo != null)
        {
            num = create_info.extentionInfo.npcDataID;
        }
        bool   flag = num > 0;
        Player player;

        if (self)
        {
            player = val.AddComponent <Self>();
            if (MonoBehaviourSingleton <InGameCameraManager> .IsValid())
            {
                MonoBehaviourSingleton <InGameCameraManager> .I.target = player._transform;
            }
        }
        else if (flag)
        {
            player = val.AddComponent <NonPlayer>();
            NonPlayer nonPlayer = player as NonPlayer;
            nonPlayer.npcId = num;
            if (Singleton <NPCTable> .IsValid())
            {
                nonPlayer.npcTableData = Singleton <NPCTable> .I.GetNPCData(num);
            }
            nonPlayer.lv       = create_info.extentionInfo.npcLv;
            nonPlayer.lv_index = create_info.extentionInfo.npcLvIndex;
        }
        else
        {
            player = val.AddComponent <Player>();
        }
        player.id = id;
        player._transform.set_position(pos);
        player._transform.set_eulerAngles(new Vector3(0f, dir, 0f));
        player.SetState(create_info, transfer_info);
        if (MonoBehaviourSingleton <InGameRecorder> .IsValid())
        {
            int userId = create_info.charaInfo.userId;
            InGameRecorder.PlayerRecord playerRecord = player.record = MonoBehaviourSingleton <InGameRecorder> .I.GetPlayer(id, userId);

            playerRecord.isSelf      = self;
            playerRecord.isNPC       = flag;
            playerRecord.charaInfo   = create_info.charaInfo;
            playerRecord.beforeLevel = create_info.charaInfo.level;
        }
        if (self)
        {
            player.AddController <SelfController>();
        }
        else if (flag)
        {
            player.AddController <NpcController>();
        }
        if (MonoBehaviourSingleton <InGameSettingsManager> .IsValid())
        {
            EffectPlayProcessor component = MonoBehaviourSingleton <InGameSettingsManager> .I.get_gameObject().GetComponent <EffectPlayProcessor>();

            if (component != null && component.effectSettings != null)
            {
                player.effectPlayProcessor = val.AddComponent <EffectPlayProcessor>();
                player.effectPlayProcessor.effectSettings = component.effectSettings;
            }
        }
        PlayerLoadInfo playerLoadInfo = new PlayerLoadInfo();

        if (player.weaponData != null)
        {
            playerLoadInfo.SetEquipWeapon(create_info.charaInfo.sex, (uint)player.weaponData.eId);
        }
        playerLoadInfo.Apply(create_info.charaInfo, false, true, true, true);
        player.Load(playerLoadInfo, callback);
        player.OnSetPlayerStatus(create_info.charaInfo.level, create_info.charaInfo.atk, create_info.charaInfo.def, create_info.charaInfo.hp, false, transfer_info);
        player.StartFieldBuff(MonoBehaviourSingleton <FieldManager> .IsValid() ? MonoBehaviourSingleton <FieldManager> .I.currentFieldBuffId : 0);
        return(player);
    }