Exemple #1
0
    private void ParseScript(string name)
    {
        ScriptParser scriptParser = new ScriptParser();
        bool         flag         = true;
        bool         flag2;

        if (flag)
        {
            flag2 = scriptParser.Parse("Localization/" + name + ".txt", flag);
        }
        else
        {
            flag2 = scriptParser.Parse("Resources/Scripts/Localization/" + name + ".txt", flag);
        }
        if (!flag2)
        {
            scriptParser.Parse("Localization/Texts_EN.txt", true);
        }
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "String" && !this.m_LocalizedTexts.ContainsKey(key.GetVariable(0).SValue))
            {
                this.m_LocalizedTexts.Add(key.GetVariable(0).SValue, key.GetVariable(1).SValue);
            }
        }
    }
    public void LoadScript(bool editor)
    {
        this.m_Dialogs.Clear();
        this.m_Groups.Clear();
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Dialogs.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "Dialog")
            {
                Dialog dialog = new Dialog(key.GetVariable(0).SValue, key.GetVariable(1).SValue, this.m_AudioSource);
                dialog.Load(key, editor);
                if (this.m_Dialogs.ContainsKey(dialog.m_Name))
                {
                    Debug.Log("[DialogsManager:LoadScript] ERROR - duplicated dialog names " + dialog.m_Name);
                }
                else
                {
                    this.m_Dialogs.Add(dialog.m_Name, dialog);
                }
            }
            else if (key.GetName() == "Group")
            {
                this.m_Groups.Add(key.GetVariable(0).SValue);
            }
        }
        this.m_Groups.Sort();
        this.m_Groups.Insert(0, DialogsManager.s_GroupALL);
    }
Exemple #3
0
    private void LoadScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse(this.m_InputsScript, true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "Action")
            {
                this.LoadAction(key, false, true);
            }
            else if (key.GetName() == "TriggerAction")
            {
                this.LoadAction(key, true, true);
            }
            else if (key.GetName() == "AxisAnalog")
            {
                this.LoadAxis(key, true);
            }
            else if (key.GetName() == "AxisDigital")
            {
                this.LoadAxis(key, false);
            }
        }
    }
    private void LoadScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Player/Player_Consciousness.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "PassingOutDuration")
            {
                this.m_PassingOutDuration = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "PassOutDuration")
            {
                this.m_PassOutDuration = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "FParam")
            {
                this.m_FParams[key.GetVariable(0).SValue] = key.GetVariable(1).FValue;
            }
            else if (key.GetName() == "EnergyToPassOut")
            {
                this.m_EnergyToPassOut = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "WormChance")
            {
                this.m_WormChance = key.GetVariable(0).FValue;
            }
        }
    }
Exemple #5
0
        private void ParseSoundFile()
        {
            ScriptParser scriptParser = new ScriptParser();

            scriptParser.Parse("AI/" + this.m_AI.m_ID.ToString() + "Sounds", true);
            this.s_IdleClips[(int)this.m_AI.m_ID]  = new List <AudioClip>();
            this.s_PanicClips[(int)this.m_AI.m_ID] = new List <AudioClip>();
            for (int i = 0; i < scriptParser.GetKeysCount(); i++)
            {
                Key key = scriptParser.GetKey(i);
                if (key.GetName() == "Idle")
                {
                    for (int j = 0; j < key.GetVariablesCount(); j++)
                    {
                        CJVariable variable = key.GetVariable(j);
                        AudioClip  item     = Resources.Load("Sounds/AI/" + this.m_AI.m_ID.ToString() + "/" + variable.SValue) as AudioClip;
                        this.s_IdleClips[(int)this.m_AI.m_ID].Add(item);
                    }
                }
                else if (key.GetName() == "Panic")
                {
                    for (int k = 0; k < key.GetVariablesCount(); k++)
                    {
                        CJVariable variable2 = key.GetVariable(k);
                        AudioClip  item2     = Resources.Load("Sounds/AI/" + this.m_AI.m_ID.ToString() + "/" + variable2.SValue) as AudioClip;
                        this.s_PanicClips[(int)this.m_AI.m_ID].Add(item2);
                    }
                }
            }
            this.s_Status[(int)this.m_AI.m_ID] = true;
        }
Exemple #6
0
    public void ParseScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Player/Player_params.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "TriggerCheckRange")
            {
                this.m_TriggerCheckRange = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "TriggerUseRange")
            {
                this.m_TriggerUseRange = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "FistFightNormalDamage")
            {
                this.m_FistFightNormalDamage = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "FistFightHardDamage")
            {
                this.m_FistFightHardDamage = key.GetVariable(0).FValue;
            }
        }
    }
Exemple #7
0
    private void LoadScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Player/Player_InjuryTreatments", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "Treatment")
            {
                InjuryType      key2            = (InjuryType)Enum.Parse(typeof(InjuryType), key.GetVariable(0).SValue);
                InjuryTreatment injuryTreatment = new InjuryTreatment();
                string          svalue          = key.GetVariable(1).SValue;
                if (svalue != null)
                {
                    string[] array = svalue.Split(new char[]
                    {
                        ';'
                    });
                    for (int j = 0; j < array.Length; j++)
                    {
                        string[] array2 = array[j].Split(new char[]
                        {
                            '*'
                        });
                        ItemID item = (ItemID)Enum.Parse(typeof(ItemID), array2[0]);
                        injuryTreatment.AddItem(item, (array2.Length > 1) ? int.Parse(array2[1]) : 1);
                    }
                }
                this.m_Treatments[(int)key2] = injuryTreatment;
            }
        }
    }
    public void LoadSettings()
    {
        this.m_ControllerCursorSpeedCurve = new AnimationCurve();
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("ControllerSettings.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "SpeedCurveKey")
            {
                Keyframe key2 = default(Keyframe);
                key2.time         = key.GetVariable(0).FValue;
                key2.value        = key.GetVariable(1).FValue;
                key2.inTangent    = key.GetVariable(2).FValue;
                key2.outTangent   = key.GetVariable(3).FValue;
                key2.inWeight     = key.GetVariable(4).FValue;
                key2.outWeight    = key.GetVariable(5).FValue;
                key2.weightedMode = (WeightedMode)key.GetVariable(6).IValue;
                this.m_ControllerCursorSpeedCurve.AddKey(key2);
            }
            else if (key.GetName() == "Speed")
            {
                this.m_ControllerCursorSpeed = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "DeadZone")
            {
                this.m_ControllerCursorDeadZone = key.GetVariable(0).FValue;
            }
        }
    }
Exemple #9
0
        private void ParseColliderBoxesScript(string script_name)
        {
            ScriptParser scriptParser = new ScriptParser();

            scriptParser.Parse("ColliderBoxes/" + script_name + ".txt", true);
            for (int i = 0; i < scriptParser.GetKeysCount(); i++)
            {
                Key key = scriptParser.GetKey(i);
                if (key.GetName() == "Bone")
                {
                    OBB     obb    = new OBB();
                    Vector3 vector = new Vector3
                    {
                        x = key.GetVariable(1).FValue,
                        y = key.GetVariable(2).FValue,
                        z = key.GetVariable(3).FValue
                    };
                    obb.half_sizes = vector;
                    vector.x       = key.GetVariable(4).FValue;
                    vector.y       = key.GetVariable(5).FValue;
                    vector.z       = key.GetVariable(6).FValue;
                    obb.start      = vector;
                    Transform transform = base.gameObject.transform.FindDeepChild(key.GetVariable(0).SValue);
                    obb.transform = transform;
                    this.m_ColliderBoxes.Add(obb);
                }
            }
        }
    private void ParseScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("FallenObjects/FallenObjects.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "SourceObject")
            {
                FallenObjectData fallenObjectData = new FallenObjectData();
                fallenObjectData.m_SourceTag        = key.GetVariable(0).SValue;
                fallenObjectData.m_FallenPrefabName = key.GetVariable(1).SValue;
                fallenObjectData.m_QuantityMin      = key.GetVariable(2).IValue;
                fallenObjectData.m_QuantityMax      = key.GetVariable(3).IValue;
                fallenObjectData.m_MinGenRadius     = key.GetVariable(4).FValue;
                fallenObjectData.m_MaxGenRadius     = key.GetVariable(5).FValue;
                fallenObjectData.m_NoRespawn        = key.GetVariable(6).BValue;
                fallenObjectData.m_Chance           = key.GetVariable(7).FValue;
                fallenObjectData.m_Cooldown         = key.GetVariable(8).FValue;
                List <FallenObjectData> list = null;
                if (!this.m_Data.TryGetValue(fallenObjectData.m_SourceTag, out list))
                {
                    this.m_Data[fallenObjectData.m_SourceTag] = new List <FallenObjectData>();
                }
                this.m_Data[fallenObjectData.m_SourceTag].Add(fallenObjectData);
            }
        }
    }
Exemple #11
0
    private void ParseScript()
    {
        this.m_Hints.Clear();
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Hints/Hints", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "Hint")
            {
                Hint hint = new Hint();
                hint.m_Name       = key.GetVariable(0).SValue;
                hint.m_ShowNTimes = key.GetVariable(1).IValue;
                for (int j = 0; j < key.GetKeysCount(); j++)
                {
                    Key key2 = key.GetKey(j);
                    if (key2.GetName() == "Text")
                    {
                        hint.m_Text          = key2.GetVariable(0).SValue;
                        hint.m_LocalizedText = GreenHellGame.Instance.GetLocalization().Get(hint.m_Text, true);
                        string key3 = GreenHellGame.Instance.GetLocalization().Contains(hint.m_Text + "Pad") ? (hint.m_Text + "Pad") : hint.m_Text;
                        hint.m_LocalizedPadText = GreenHellGame.Instance.GetLocalization().Get(key3, false);
                    }
                    else if (key2.GetName() == "Duration")
                    {
                        hint.m_Duration = key2.GetVariable(0).FValue;
                    }
                }
                this.m_Hints.Add(hint);
            }
        }
    }
Exemple #12
0
    private void ParseScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Weather/Rain.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "Rain")
            {
                RainData rainData = new RainData();
                rainData.m_RainDuration = key.GetVariable(0).FValue;
                rainData.m_RainInterval = key.GetVariable(1).FValue;
                this.m_RainData.Add(rainData);
            }
            else if (key.GetName() == "RainCollectorFillPerSecondRain")
            {
                this.m_RainCollectorFillPerSecondRain = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "RainCollectorFillPerSecondNoRain")
            {
                if (GreenHellGame.ROADSHOW_DEMO)
                {
                    this.m_RainCollectorFillPerSecondNoRain = 10f;
                }
                else
                {
                    this.m_RainCollectorFillPerSecondNoRain = key.GetVariable(0).FValue;
                }
            }
        }
    }
Exemple #13
0
    private void ParseDebugScript()
    {
        if (!File.Exists(Application.dataPath + "/Resources/scripts/Debug/" + base.name))
        {
            return;
        }
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("/Resources/scripts/Debug/" + base.name, false);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "LoadingRange")
            {
                this.loadingRange.Set(key.GetVariable(0).FValue, key.GetVariable(1).FValue, key.GetVariable(2).FValue);
            }
            else if (key.GetName() == "LoadingRangeMin")
            {
                this.loadingRangeMin.Set(key.GetVariable(0).FValue, key.GetVariable(1).FValue, key.GetVariable(2).FValue);
            }
            else if (key.GetName() == "DeloadingRange")
            {
                this.deloadingRange.Set(key.GetVariable(0).FValue, key.GetVariable(1).FValue, key.GetVariable(2).FValue);
            }
        }
    }
Exemple #14
0
    private void Awake()
    {
        Music.s_Instance = this;
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("MusicsMap.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            this.m_MusicsMap[key.GetVariable(0).SValue] = key.GetVariable(1).SValue;
        }
    }
Exemple #15
0
    private void ParseScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Scenario/ScenarioDebugSpawners.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            if (scriptParser.GetKey(i).GetName() == "DebugSpawner")
            {
                string svalue = scriptParser.GetKey(i).GetVariable(0).SValue;
                this.m_List.AddElement(svalue, -1);
            }
        }
    }
Exemple #16
0
    public IconColors()
    {
        IconColors.s_Instance = this;
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("IconColors", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key             key   = scriptParser.GetKey(i);
            IconColors.Icon key2  = (IconColors.Icon)Enum.Parse(typeof(IconColors.Icon), key.GetName());
            Color           value = new Color((float)key.GetVariable(0).IValue / 255f, (float)key.GetVariable(1).IValue / 255f, (float)key.GetVariable(2).IValue / 255f, (float)key.GetVariable(3).IValue / 255f);
            this.m_ColorsData.Add(key2, value);
        }
    }
Exemple #17
0
    private void ParseScript(string name)
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Localization/" + name + ".txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "String" && !this.m_LocalizedTexts.ContainsKey(key.GetVariable(0).SValue))
            {
                this.m_LocalizedTexts.Add(key.GetVariable(0).SValue, key.GetVariable(1).SValue);
            }
        }
    }
    private void InitScenarioScenes()
    {
        base.gameObject.AddComponent <SceneLoadUnloadRequestHolder>();
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("ScenarioScenes", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "Scene")
            {
                this.m_ScenarioScenes.Add(key.GetVariable(0).SValue);
            }
        }
    }
Exemple #19
0
    private void ParseScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Objectives/StoryObjectives.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "Objective")
            {
                Objective item = new Objective(key.GetVariable(0).SValue, key.GetVariable(1).SValue);
                this.m_Objectives.Add(item);
            }
        }
    }
    private void LoadScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Player/Player_Diseases.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "Disease")
            {
                string svalue = key.GetVariable(0).SValue;
                Type   type   = Type.GetType(svalue);
                if (type == null)
                {
                    DebugUtils.Assert(DebugUtils.AssertType.Info);
                }
                else
                {
                    Disease disease = Activator.CreateInstance(type) as Disease;
                    string  svalue2 = key.GetVariable(0).SValue;
                    disease.m_Type = (ConsumeEffect)Enum.Parse(typeof(ConsumeEffect), svalue2);
                    for (int j = 0; j < key.GetKeysCount(); j++)
                    {
                        Key key2 = key.GetKey(j);
                        disease.Load(key2);
                    }
                    this.m_Diseases.Add((int)disease.GetDiseaseType(), disease);
                }
            }
            else if (key.GetName() == "Symptom")
            {
                string svalue3 = key.GetVariable(0).SValue;
                Type   type2   = Type.GetType(svalue3);
                if (type2 == null)
                {
                    DebugUtils.Assert(DebugUtils.AssertType.Info);
                }
                else
                {
                    global::DiseaseSymptom diseaseSymptom = Activator.CreateInstance(type2) as global::DiseaseSymptom;
                    diseaseSymptom.Initialize();
                    diseaseSymptom.SetPlayerDiseasesModule(this);
                    diseaseSymptom.ParseKey(key);
                    this.m_Symptoms.Add((int)diseaseSymptom.GetSymptomType(), diseaseSymptom);
                }
            }
        }
    }
Exemple #21
0
    private void LoadMultisamples()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("MultiSample/MultiSamples", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "MultiSample")
            {
                MSMultiSample msmultiSample = new MSMultiSample();
                msmultiSample.Load(key);
                this.m_MultiSamples.Add(msmultiSample);
            }
        }
    }
Exemple #22
0
    public void ParseScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Player/Player_params.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "Param")
            {
                switch (key.GetVariable(1).GetVariableType())
                {
                case CJVariable.TYPE.String:
                    this.m_Params.Add(key.GetVariable(0).SValue, new PlayerParams.PlayerParamTyped <string>(key.GetVariable(1).SValue));
                    break;

                case CJVariable.TYPE.Int:
                    this.m_Params.Add(key.GetVariable(0).SValue, new PlayerParams.PlayerParamTyped <int>(key.GetVariable(1).IValue));
                    break;

                case CJVariable.TYPE.Float:
                    this.m_Params.Add(key.GetVariable(0).SValue, new PlayerParams.PlayerParamTyped <float>(key.GetVariable(1).FValue));
                    break;

                case CJVariable.TYPE.Bool:
                    this.m_Params.Add(key.GetVariable(0).SValue, new PlayerParams.PlayerParamTyped <bool>(key.GetVariable(1).BValue));
                    break;
                }
            }
            else if (key.GetName() == "TriggerCheckRange")
            {
                this.m_TriggerCheckRange = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "TriggerUseRange")
            {
                this.m_TriggerUseRange = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "FistFightNormalDamage")
            {
                this.m_FistFightNormalDamage = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "FistFightHardDamage")
            {
                this.m_FistFightHardDamage = key.GetVariable(0).FValue;
            }
        }
    }
Exemple #23
0
    private void LoadScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Player/Player_Sleep.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "FParam")
            {
                this.m_FParams.Add(new SleepController.ConditionFParam
                {
                    field_name = key.GetVariable(0).SValue,
                    value      = key.GetVariable(1).FValue,
                    category   = ((key.GetVariablesCount() > 2) ? key.GetVariable(2).SValue : string.Empty)
                });
            }
            else if (key.GetName() == "SleepDuration")
            {
                this.m_SleepDuration = key.GetVariable(0).IValue;
            }
            else if (key.GetName() == "SleepDurationCoopMul")
            {
                this.m_SleepDurationCoopMul = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "WormChance")
            {
                this.m_WormChance = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "WoundWormChanceFactor")
            {
                this.m_WoundWormChanceFactor = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "RainWormChanceFactor")
            {
                this.m_RainWormChanceFactor = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "BedWormChanceFactor")
            {
                this.m_BedWormChanceFactor.Add((int)Enum.Parse(typeof(ItemID), key.GetVariable(0).SValue), key.GetVariable(1).FValue);
            }
            else if (key.GetName() == "FireWormChanceFactor")
            {
                this.m_FireWormChanceFactor.Add((int)Enum.Parse(typeof(ItemID), key.GetVariable(0).SValue), key.GetVariable(1).FValue);
            }
        }
    }
Exemple #24
0
    private void ParseScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("StaticBatching/StaticBatching.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "Mesh" && !this.m_ReplaceMap.ContainsKey(key.GetVariable(0).SValue))
            {
                StaticObjectsReplace staticObjectsReplace = new StaticObjectsReplace();
                staticObjectsReplace.m_PrefabName = key.GetVariable(1).SValue;
                staticObjectsReplace.m_Prefab     = GreenHellGame.Instance.GetPrefab(staticObjectsReplace.m_PrefabName);
                DebugUtils.Assert(staticObjectsReplace.m_Prefab != null, "[StaticObjectsManager:ParseScript] Can't find prefab - " + staticObjectsReplace.m_PrefabName, true, DebugUtils.AssertType.Info);
                this.m_ReplaceMap.Add(key.GetVariable(0).SValue, staticObjectsReplace);
            }
        }
    }
Exemple #25
0
    private void ParseScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Scenario/ScenarioDebugSpawners.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            if (scriptParser.GetKey(i).GetName() == "DebugSpawner")
            {
                string   svalue = scriptParser.GetKey(i).GetVariable(0).SValue;
                string[] data   = (scriptParser.GetKey(i).GetVariablesCount() > 1) ? scriptParser.GetKey(i).GetVariable(1).SValue.Split(new char[]
                {
                    ','
                }) : new string[0];
                this.m_List.AddElement <string[]>(svalue, data);
            }
        }
    }
Exemple #26
0
    private void Awake()
    {
        PlayerWalkieTalkieModule.s_Instance = this;
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Player/PlayerWalkieTalkie", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "CallBatteryUse")
            {
                this.m_CallBatteryUse = key.GetVariable(0).FValue;
            }
            else if (key.GetName() == "BatteryRestorePerSec")
            {
                this.m_BatteryRestorePerSec = key.GetVariable(0).FValue;
            }
        }
    }
    private void LoadScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse(this.m_LutTextureScript, true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "Effect")
            {
                LutTextureData lutTextureData = new LutTextureData();
                lutTextureData.m_Effect          = (LutTextureManager.LutEffect)Enum.Parse(typeof(LutTextureManager.LutEffect), key.GetVariable(0).SValue);
                lutTextureData.m_LutTexture      = key.GetVariable(1).SValue;
                lutTextureData.m_LutBlendTexture = key.GetVariable(2).SValue;
                lutTextureData.m_MaskTexture     = key.GetVariable(3).SValue;
                lutTextureData.m_BlendAmount     = key.GetVariable(4).FValue;
                this.m_Datas.Add(lutTextureData.m_Effect, lutTextureData);
            }
        }
    }
Exemple #28
0
    private void LoadScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Challenges.txt", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "Challenge")
            {
                Type type = Type.GetType(key.GetVariable(1).SValue);
                if (!DebugUtils.Assert(type != null, "ERROR - Can't create goal " + key.GetVariable(0).SValue, true, DebugUtils.AssertType.Info))
                {
                    Challenge challenge = Activator.CreateInstance(type) as Challenge;
                    challenge.Load(key);
                    this.m_Challenges.Add(challenge);
                }
            }
        }
    }
        private static void ParseSoundFile(AI.AIID ai_id)
        {
            ScriptParser scriptParser = new ScriptParser();

            scriptParser.Parse("AI/" + ai_id.ToString() + "Sounds", true);
            AISoundModule.s_IdleClips[(int)ai_id]  = new List <AudioClip>();
            AISoundModule.s_PanicClips[(int)ai_id] = new List <AudioClip>();
            AISoundModule.s_DeathClips[(int)ai_id] = new List <AudioClip>();
            for (int i = 0; i < scriptParser.GetKeysCount(); i++)
            {
                Key key = scriptParser.GetKey(i);
                if (key.GetName() == "Idle")
                {
                    for (int j = 0; j < key.GetVariablesCount(); j++)
                    {
                        CJVariable variable = key.GetVariable(j);
                        AudioClip  item     = Resources.Load("Sounds/AI/" + ai_id.ToString() + "/" + variable.SValue) as AudioClip;
                        AISoundModule.s_IdleClips[(int)ai_id].Add(item);
                    }
                }
                else if (key.GetName() == "Panic")
                {
                    for (int k = 0; k < key.GetVariablesCount(); k++)
                    {
                        CJVariable variable2 = key.GetVariable(k);
                        AudioClip  item2     = Resources.Load("Sounds/AI/" + ai_id.ToString() + "/" + variable2.SValue) as AudioClip;
                        AISoundModule.s_PanicClips[(int)ai_id].Add(item2);
                    }
                }
                else if (key.GetName() == "Death")
                {
                    for (int l = 0; l < key.GetVariablesCount(); l++)
                    {
                        CJVariable variable3 = key.GetVariable(l);
                        AudioClip  item3     = Resources.Load("Sounds/AI/" + ai_id.ToString() + "/" + variable3.SValue) as AudioClip;
                        AISoundModule.s_DeathClips[(int)ai_id].Add(item3);
                    }
                }
            }
            AISoundModule.s_Status[(int)ai_id] = true;
        }
Exemple #30
0
    private void ParseHintsScript()
    {
        ScriptParser scriptParser = new ScriptParser();

        scriptParser.Parse("Hints/HUDDeath_Hints", true);
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "Hint")
            {
                if (!this.m_Hints.Keys.Contains(key.GetVariable(0).SValue))
                {
                    this.m_Hints.Add(key.GetVariable(0).SValue, new List <string>());
                    this.m_Hints[key.GetVariable(0).SValue].Add(key.GetVariable(1).SValue);
                }
                else
                {
                    this.m_Hints[key.GetVariable(0).SValue].Add(key.GetVariable(1).SValue);
                }
            }
        }
    }