Ejemplo n.º 1
0
    public static IEnumerator InitRoopEffect(LoadingQueue queue, Transform equipItemRoot, SHADER_TYPE shaderType = SHADER_TYPE.NORMAL)
    {
        EffectPlayProcessor processor = equipItemRoot.get_gameObject().GetComponentInChildren <EffectPlayProcessor>();

        if (processor != null && processor.effectSettings != null)
        {
            int j = 0;
            for (int len = processor.effectSettings.Length; j < len; j++)
            {
                if (!string.IsNullOrEmpty(processor.effectSettings[j].effectName))
                {
                    queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, processor.effectSettings[j].effectName);
                }
            }
        }
        yield return((object)queue.Wait());

        if (processor != null)
        {
            List <Transform> trans = processor.PlayEffect("InitRoop", null);
            if (trans != null)
            {
                for (int i = 0; i < trans.Count; i++)
                {
                    Utility.SetLayerWithChildren(trans[i], equipItemRoot.get_gameObject().get_layer());
                    if (shaderType != 0)
                    {
                        Renderer[] rs = trans[i].GetComponentsInChildren <Renderer>();
                        switch (shaderType)
                        {
                        case SHADER_TYPE.LIGHTWEIGHT:
                            ShaderGlobal.ChangeWantLightweightShader(rs);
                            break;

                        case SHADER_TYPE.UI:
                            ShaderGlobal.ChangeWantUIShader(rs);
                            break;
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 2
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);
    }
Ejemplo n.º 3
0
    private IEnumerator DoLoad(int body_id, int anim_id, float scale, string base_effect, string base_effect_node, bool need_shadow, bool enable_light_probes, bool need_anim_event_res_cache, SHADER_TYPE shader_type, int layer, string foundation_name, bool need_stamp_effect, bool will_stock, OnCompleteLoad callback)
    {
        Enemy enemy = this.get_gameObject().GetComponent <Enemy>();

        if (enemy != null)
        {
            int id = enemy.id;
        }
        bodyID    = body_id;
        bodyScale = scale;
        bool is_boss = false;

        if (enemy != null)
        {
            is_boss = enemy.isBoss;
            if (enemy.controller != null)
            {
                enemy.controller.set_enabled(false);
            }
            if (enemy.packetReceiver != null)
            {
                enemy.packetReceiver.SetStopPacketUpdate(true);
            }
            enemy.OnLoadStart();
        }
        string    body_name = ResourceName.GetEnemyBody(body_id);
        string    mate_name = ResourceName.GetEnemyMaterial(body_id);
        string    anim_name = ResourceName.GetEnemyAnim(anim_id);
        Transform _this     = this.get_transform();

        isLoading = true;
        LoadingQueue load_queue = new LoadingQueue(this);
        LoadObject   lo_body    = load_queue.LoadAndInstantiate(RESOURCE_CATEGORY.ENEMY_MODEL, body_name);
        LoadObject   lo_mate    = (mate_name == null) ? null : load_queue.Load(RESOURCE_CATEGORY.ENEMY_MATERIAL, body_name, new string[1]
        {
            mate_name
        }, false);
        LoadObject lo_anim = load_queue.Load(RESOURCE_CATEGORY.ENEMY_ANIM, anim_name, new string[2]
        {
            anim_name + "Ctrl",
            anim_name + "Event"
        }, false);

        if (!string.IsNullOrEmpty(base_effect))
        {
            load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, base_effect);
        }
        LoadObject lo_foundation = null;

        if (!string.IsNullOrEmpty(foundation_name))
        {
            if (!MonoBehaviourSingleton <GlobalSettingsManager> .I.uiModelRendering.enableEnemyModelFoundationFromQuestStage)
            {
                foundation_name = "FST011";
            }
            lo_foundation = load_queue.LoadAndInstantiate(RESOURCE_CATEGORY.FOUNDATION_MODEL, foundation_name);
        }
        yield return((object)load_queue.Wait());

        body = lo_body.Realizes(_this, (layer != -1) ? layer : 11);
        if (layer == -1)
        {
            this.get_gameObject().set_layer(10);
        }
        body.set_localPosition(Vector3.get_zero());
        body.set_localRotation(Quaternion.get_identity());
        renderersBody = body.get_gameObject().GetComponentsInChildren <Renderer>();
        if (lo_mate != null && lo_mate.loadedObject != null && renderersBody.Length == 1)
        {
            Material mate = lo_mate.loadedObject as Material;
            if (mate != null)
            {
                renderersBody[0].set_sharedMaterial(mate);
            }
        }
        if (enemy != null)
        {
            enemy.body = body;
        }
        body.set_localScale(Vector3.Scale(body.get_localScale(), new Vector3(scale, scale, scale)));
        animator = body.get_gameObject().GetComponent <Animator>();
        if (animator != null && lo_anim.loadedObjects != null)
        {
            animator.set_runtimeAnimatorController(lo_anim.loadedObjects[0].obj);
            if (lo_anim.loadedObjects.Length >= 2 && lo_anim.loadedObjects[1] != null)
            {
                this.animEventData = (lo_anim.loadedObjects[1].obj as AnimEventData);
            }
            if (enemy != null)
            {
                body.get_gameObject().AddComponent <StageObjectProxy>().stageObject = enemy;
                enemy.animEventData = this.animEventData;
            }
        }
        if (!string.IsNullOrEmpty(base_effect))
        {
            string node_name = base_effect_node;
            if (string.IsNullOrEmpty(node_name))
            {
                node_name = "Root";
            }
            Transform node             = Utility.Find(body, node_name);
            Transform effect_transform = EffectManager.GetEffect(base_effect, node);
            if (effect_transform != null)
            {
                baseEffect = effect_transform;
                if (layer != -1)
                {
                    Utility.SetLayerWithChildren(effect_transform, layer);
                }
            }
        }
        if (shader_type == SHADER_TYPE.LIGHTWEIGHT)
        {
            ShaderGlobal.ChangeWantLightweightShader(renderersBody);
        }
        if (is_boss)
        {
            materialParamsList = new List <MaterialParams>();
            Shader.PropertyToID("_RimPower");
            Shader.PropertyToID("_RimWidth");
            Shader.PropertyToID("_Vanish_flag");
            Shader.PropertyToID("_Vanish_rate");
            Utility.MaterialForEach(renderersBody, delegate(Material material)
            {
                if (material != null)
                {
                    MaterialParams materialParams = new MaterialParams
                    {
                        material = material
                    };
                    if (materialParams.hasRimPower = material.HasProperty(((_003CDoLoad_003Ec__Iterator228) /*Error near IL_062d: stateMachine*/)._003CID_RIM_POWER_003E__16))
                    {
                        materialParams.defaultRimPower = material.GetFloat(((_003CDoLoad_003Ec__Iterator228) /*Error near IL_062d: stateMachine*/)._003CID_RIM_POWER_003E__16);
                    }
                    if (materialParams.hasRimWidth = material.HasProperty(((_003CDoLoad_003Ec__Iterator228) /*Error near IL_062d: stateMachine*/)._003CID_RIM_WIDTH_003E__17))
                    {
                        materialParams.defaultRimWidth = material.GetFloat(((_003CDoLoad_003Ec__Iterator228) /*Error near IL_062d: stateMachine*/)._003CID_RIM_WIDTH_003E__17);
                    }
                    materialParams.hasVanishFlag = material.HasProperty(((_003CDoLoad_003Ec__Iterator228) /*Error near IL_062d: stateMachine*/)._003CID_VANISH_FLAG_003E__18);
                    materialParams.hasVanishRate = material.HasProperty(((_003CDoLoad_003Ec__Iterator228) /*Error near IL_062d: stateMachine*/)._003CID_VANISH_RATE_003E__19);
                    ((_003CDoLoad_003Ec__Iterator228) /*Error near IL_062d: stateMachine*/)._003C_003Ef__this.materialParamsList.Add(materialParams);
                }
            });
        }
        int l = 0;

        for (int k = renderersBody.Length; l < k; l++)
        {
            renderersBody[l].set_useLightProbes(enable_light_probes);
        }
        EnemyParam param = body.get_gameObject().GetComponent <EnemyParam>();

        body.get_gameObject().SetActive(false);
        if (need_anim_event_res_cache && animator != null && lo_anim.loadedObjects != null && lo_anim.loadedObjects[1] != null)
        {
            AnimEventData tmpAnimEventData = lo_anim.loadedObjects[1].obj as AnimEventData;
            if (tmpAnimEventData != null)
            {
                if (enemy == null)
                {
                    load_queue.CacheAnimDataUseResource(tmpAnimEventData, null, null);
                }
                else
                {
                    LoadingQueue  loadingQueue  = load_queue;
                    AnimEventData animEventData = tmpAnimEventData;
                    Enemy         enemy2        = enemy;
                    loadingQueue.CacheAnimDataUseResource(animEventData, ((Character)enemy2).EffectNameAnalyzer, enemy.continusAtkEventDataList);
                }
                PreSetAnimationEventDataParamToEnemy(tmpAnimEventData, enemy);
            }
        }
        AnimEventData.ResidentEffectData[] residentEffectList = null;
        if (this.animEventData != null)
        {
            residentEffectList = this.animEventData.residentEffectDataList;
            if (residentEffectList != null)
            {
                int numEffect3 = residentEffectList.Length;
                for (int ef3 = 0; ef3 < numEffect3; ef3++)
                {
                    if (!string.IsNullOrEmpty(residentEffectList[ef3].effectName))
                    {
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, residentEffectList[ef3].effectName);
                    }
                }
            }
        }
        if (param != null)
        {
            if (enemy != null || need_stamp_effect)
            {
                StageObject.StampInfo[] stampInfos = param.stampInfos;
                foreach (StageObject.StampInfo info4 in stampInfos)
                {
                    load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, info4.effectName);
                }
            }
            if (param.isHide)
            {
                FieldMapTable.GatherPointViewTableData viewData = Singleton <FieldMapTable> .I.GetGatherPointViewData(param.gatherPointViewId);

                if (viewData != null)
                {
                    if (!string.IsNullOrEmpty(viewData.targetEffectName))
                    {
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, viewData.targetEffectName);
                    }
                    if (!string.IsNullOrEmpty(viewData.gatherEffectName))
                    {
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, viewData.gatherEffectName);
                    }
                }
            }
            SystemEffectSetting sysEffectSetting2 = param.residentEffectSetting;
            if (sysEffectSetting2 != null)
            {
                SystemEffectSetting.Data[] effectDataList = sysEffectSetting2.effectDataList;
                if (effectDataList != null)
                {
                    int numEffect2 = effectDataList.Length;
                    for (int ef2 = 0; ef2 < numEffect2; ef2++)
                    {
                        if (!string.IsNullOrEmpty(effectDataList[ef2].effectName))
                        {
                            load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, effectDataList[ef2].effectName);
                        }
                    }
                }
            }
        }
        if (load_queue.IsLoading())
        {
            yield return((object)load_queue.Wait());
        }
        if (enemy != null)
        {
            if (param != null)
            {
                EnemyTable.EnemyData data           = enemy.enemyTableData;
                AttackHitInfo[]      attackHitInfos = param.attackHitInfos;
                foreach (AttackHitInfo temp_info in attackHitInfos)
                {
                    AttackHitInfo info = temp_info;
                    if (!string.IsNullOrEmpty(data.convertRegionKey))
                    {
                        string          convert_name          = info.name + "_" + data.convertRegionKey;
                        AttackHitInfo[] convertAttackHitInfos = param.convertAttackHitInfos;
                        foreach (AttackHitInfo convert_info in convertAttackHitInfos)
                        {
                            if (convert_info.name == convert_name)
                            {
                                info = convert_info;
                                break;
                            }
                        }
                    }
                    if (info.hitSEID != 0)
                    {
                        load_queue.CacheSE(info.hitSEID, null);
                    }
                    load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, info.hitEffectName);
                    load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, info.remainEffectName);
                    load_queue.CacheBulletDataUseResource(info.bulletData, null);
                    RestraintInfo restInfo = temp_info.restraintInfo;
                    if (restInfo.enable && !string.IsNullOrEmpty(restInfo.effectName))
                    {
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, restInfo.effectName);
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, "ef_btl_target_flick");
                        if (temp_info.toPlayer.reactionType != 0)
                        {
                            Log.Error(LOG.INGAME, "Can't use reactionType with RestraintInfo!! " + temp_info.name);
                        }
                    }
                    GrabInfo grabInfo = temp_info.grabInfo;
                    if (grabInfo != null && grabInfo.enable && temp_info.toPlayer.reactionType != 0)
                    {
                        Log.Error(LOG.INGAME, "Can't use reactionType with GrabInfo!! " + temp_info.name);
                    }
                    InkSplashInfo inkSplashInfo = temp_info.inkSplashInfo;
                    if (inkSplashInfo != null && inkSplashInfo.duration > 0f)
                    {
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, "ef_btl_pl_blind_01");
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, "ef_btl_pl_blind_02");
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, "ef_btl_target_flick");
                    }
                }
                AttackContinuationInfo[] attackContinuationInfos = param.attackContinuationInfos;
                foreach (AttackContinuationInfo temp_info2 in attackContinuationInfos)
                {
                    AttackContinuationInfo info2 = temp_info2;
                    if (!string.IsNullOrEmpty(data.convertRegionKey))
                    {
                        string convert_name2 = info2.name + "_" + data.convertRegionKey;
                        AttackContinuationInfo[] convertAttackContinuationInfos = param.convertAttackContinuationInfos;
                        foreach (AttackContinuationInfo convert_info2 in convertAttackContinuationInfos)
                        {
                            if (convert_info2.name == convert_name2)
                            {
                                info2 = convert_info2;
                                break;
                            }
                        }
                    }
                    load_queue.CacheBulletDataUseResource(info2.bulletData, null);
                }
                Enemy.RegionInfo[] regionInfos = param.regionInfos;
                foreach (Enemy.RegionInfo temp_info3 in regionInfos)
                {
                    Enemy.RegionInfo info3 = temp_info3;
                    if (!string.IsNullOrEmpty(data.convertRegionKey))
                    {
                        string             convert_name3      = info3.name + "_" + data.convertRegionKey;
                        Enemy.RegionInfo[] convertRegionInfos = param.convertRegionInfos;
                        foreach (Enemy.RegionInfo convert_info3 in convertRegionInfos)
                        {
                            if (convert_info3.name == convert_name3)
                            {
                                info3 = convert_info3;
                                break;
                            }
                        }
                    }
                    load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, info3.breakEffect.effectName);
                }
                if (Singleton <EnemyHitMaterialTable> .IsValid())
                {
                    int j = 0;
                    for (int len2 = param.regionInfos.Length; j < len2 + 1; j++)
                    {
                        string hit_material_name = (j >= len2) ? param.baseHitMaterialName : param.regionInfos[j].hitMaterialName;
                        if (!string.IsNullOrEmpty(hit_material_name))
                        {
                            EnemyHitMaterialTable.MaterialData check_data = Singleton <EnemyHitMaterialTable> .I.GetData(hit_material_name);

                            if (check_data != null)
                            {
                                load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, check_data.addEffectName);
                                int[] typeSEIDs = check_data.typeSEIDs;
                                foreach (int type_se_id in typeSEIDs)
                                {
                                    if (type_se_id != 0)
                                    {
                                        load_queue.CacheSE(type_se_id, null);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (MonoBehaviourSingleton <InGameSettingsManager> .IsValid())
            {
                load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, MonoBehaviourSingleton <GlobalSettingsManager> .I.linkResources.enemyParalyzeHitEffectName);
                load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, MonoBehaviourSingleton <GlobalSettingsManager> .I.linkResources.enemyPoisonHitEffectName);
            }
            load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, "ef_btl_enm_shock_01");
            load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, "ef_btl_enm_fire_01");
            load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, "ef_btl_pl_movedown_01");
            EffectPlayProcessor processor = body.get_gameObject().GetComponent <EffectPlayProcessor>();
            if (processor != null && processor.effectSettings != null)
            {
                enemy.effectPlayProcessor = processor;
                int i = 0;
                for (int len = processor.effectSettings.Length; i < len; i++)
                {
                    if (!string.IsNullOrEmpty(processor.effectSettings[i].effectName))
                    {
                        load_queue.CacheEffect(RESOURCE_CATEGORY.EFFECT_ACTION, processor.effectSettings[i].effectName);
                    }
                }
            }
            if (load_queue.IsLoading())
            {
                yield return((object)load_queue.Wait());
            }
        }
        body.get_gameObject().SetActive(true);
        if (residentEffectList != null)
        {
            int numEffect = residentEffectList.Length;
            for (int ef = 0; ef < numEffect; ef++)
            {
                AnimEventData.ResidentEffectData effectData = residentEffectList[ef];
                if (!string.IsNullOrEmpty(effectData.effectName) && !string.IsNullOrEmpty(effectData.linkNodeName))
                {
                    Transform parentTrans = Utility.Find(body.get_transform(), effectData.linkNodeName);
                    if (parentTrans == null)
                    {
                        parentTrans = body.get_transform();
                    }
                    Transform effectTrans = EffectManager.GetEffect(effectData.effectName, parentTrans);
                    if (effectTrans != null)
                    {
                        if (layer != -1)
                        {
                            Utility.SetLayerWithChildren(effectTrans, layer);
                        }
                        Vector3 basisScale = effectTrans.get_localScale();
                        effectTrans.set_localScale(basisScale * effectData.scale);
                        effectTrans.set_localPosition(effectData.offsetPos);
                        effectTrans.set_localRotation(Quaternion.Euler(effectData.offsetRot));
                        ResidentEffectObject residentEffect = effectTrans.get_gameObject().AddComponent <ResidentEffectObject>();
                        residentEffect.Initialize(effectData);
                        if (enemy != null)
                        {
                            enemy.RegisterResidentEffect(residentEffect);
                        }
                    }
                }
            }
        }
        if (param != null)
        {
            SystemEffectSetting sysEffectSetting = param.residentEffectSetting;
            SysEffectCreate(enemy, layer, sysEffectSetting);
        }
        if (need_shadow && param != null && param.shadowSize > 0f)
        {
            shadow = MonoBehaviourSingleton <GlobalSettingsManager> .I.linkResources.CreateShadow(param.shadowSize, param.bodyRadius, bodyScale, true, _this, shader_type == SHADER_TYPE.LIGHTWEIGHT);
        }
        if (enemy != null)
        {
            if (param != null)
            {
                param.SetParam(enemy);
                Object.DestroyImmediate(param);
            }
            if (enemy.controller != null)
            {
                enemy.controller.set_enabled(true);
            }
            enemy.willStock = will_stock;
            enemy.OnLoadComplete();
            if (enemy.packetReceiver != null)
            {
                enemy.packetReceiver.SetStopPacketUpdate(false);
            }
        }
        callback?.Invoke(enemy);
        if (lo_foundation != null)
        {
            foundation = lo_foundation.Realizes(_this, layer);
            foundation.SetParent(_this.get_parent(), true);
        }
        isLoading = false;
    }