コード例 #1
0
        override public float Run()
        {
            if (newVariableID != -1 && oldVariableID != -1)
            {
                GVar oldVar;
                if (oldLocation == VariableLocation.Global)
                {
                    oldVar = RuntimeVariables.GetVariable(oldVariableID);
                }
                else
                {
                    oldVar = LocalVariables.GetVariable(oldVariableID);
                }

                if (newLocation == VariableLocation.Local && !isAssetFile)
                {
                    SetVariable(LocalVariables.GetVariable(newVariableID), VariableLocation.Local, oldVar);
                }
                else
                {
                    SetVariable(RuntimeVariables.GetVariable(newVariableID), VariableLocation.Global, oldVar);
                }
            }

            return(0f);
        }
コード例 #2
0
ファイル: MenuLabel.cs プロジェクト: IJkeB/Ekster_Final
        public override string GetLabel(int slot, int languageNumber)
        {
            if (labelType == AC_LabelType.Normal)
            {
                return(TranslateLabel(label, languageNumber));
            }
            else if (labelType == AC_LabelType.DialogueSpeaker)
            {
                return(KickStarter.dialog.GetSpeaker());
            }
            else if (labelType == AC_LabelType.GlobalVariable)
            {
                return(RuntimeVariables.GetVariable(variableID).GetValue());
            }
            else if (labelType == AC_LabelType.Hotspot)
            {
                return(KickStarter.playerMenus.GetHotspotLabel());
            }
            else if (labelType == AC_LabelType.ActiveSaveProfile)
            {
                if (Application.isPlaying)
                {
                    return(KickStarter.options.GetProfileName());
                }
                else
                {
                    return(label);
                }
            }

            return("");
        }
コード例 #3
0
        private void CalculateValue()
        {
            if (!Application.isPlaying)
            {
                return;
            }

            if (toggleType == AC_ToggleType.Subtitles)
            {
                if (KickStarter.options != null && KickStarter.options.optionsData != null)
                {
                    isOn = KickStarter.options.optionsData.showSubtitles;
                }
            }
            else if (toggleType == AC_ToggleType.Variable)
            {
                if (varID >= 0)
                {
                    if (RuntimeVariables.GetVariable(varID).type != VariableType.Boolean)
                    {
                        Debug.LogWarning("Cannot link MenuToggle " + title + " to Variable " + varID + " as it is not a Boolean.");
                    }
                    else
                    {
                        isOn = RuntimeVariables.GetBooleanValue(varID);;
                    }
                }
            }
        }
コード例 #4
0
ファイル: MenuCycle.cs プロジェクト: IJkeB/Ekster1
        private void CalculateValue()
        {
            if (!Application.isPlaying)
            {
                return;
            }

            if (cycleType == AC_CycleType.Language)
            {
                optionsArray = KickStarter.speechManager.languages;
                if (KickStarter.options.optionsData != null)
                {
                    selected = KickStarter.options.optionsData.language;
                }
            }
            else if (cycleType == AC_CycleType.Variable)
            {
                if (varID >= 0)
                {
                    if (RuntimeVariables.GetVariable(varID) == null || RuntimeVariables.GetVariable(varID).type != VariableType.Integer)
                    {
                        Debug.LogWarning("Cannot link MenuToggle " + title + " to Variable " + varID + " as it is not an Integer.");
                    }
                    else if (optionsArray.Count > 0)
                    {
                        selected = Mathf.Clamp(RuntimeVariables.GetIntegerValue(varID), 0, optionsArray.Count - 1);
                    }
                    else
                    {
                        selected = 0;
                    }
                }
            }
        }
コード例 #5
0
ファイル: ActionVarPopup.cs プロジェクト: IJkeB/Ekster1
        private GVar GetVariable()
        {
            GVar var = null;

            if (location == VariableLocation.Local && !isAssetFile)
            {
                var = LocalVariables.GetVariable(variableID);
            }
            else
            {
                if (Application.isPlaying)
                {
                    var = RuntimeVariables.GetVariable(variableID);
                }
                else if (AdvGame.GetReferences().variablesManager)
                {
                    var = AdvGame.GetReferences().variablesManager.GetVariable(variableID);
                }
            }

            if (var != null && var.type == VariableType.PopUp)
            {
                return(var);
            }

            return(null);
        }
コード例 #6
0
        override public ActionEnd End(List <AC.Action> actions)
        {
            if (_parameter == null)
            {
                return(GenerateStopActionEnd());
            }

            GVar    compareVar  = null;
            InvItem compareItem = null;

            if (_parameter.parameterType == ParameterType.GlobalVariable || _parameter.parameterType == ParameterType.LocalVariable || _parameter.parameterType == ParameterType.InventoryItem)
            {
                if (compareVariableID == -1)
                {
                    return(GenerateStopActionEnd());
                }

                if (_parameter.parameterType == ParameterType.GlobalVariable)
                {
                    compareVar = RuntimeVariables.GetVariable(compareVariableID);
                    compareVar.Download();
                }
                else if (_parameter.parameterType == ParameterType.LocalVariable && !isAssetFile)
                {
                    compareVar = LocalVariables.GetVariable(compareVariableID);
                }
                else if (_parameter.parameterType == ParameterType.InventoryItem)
                {
                    compareItem = KickStarter.runtimeInventory.GetItem(compareVariableID);
                }
            }

            return(ProcessResult(CheckCondition(compareItem, compareVar), actions));
        }
コード例 #7
0
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (KickStarter.stateHandler.gameState == GameState.Cutscene)
            {
                return;
            }

            base.ProcessClick(_menu, _slot, _mouseState);
            if (uiToggle != null)
            {
                isOn = uiToggle.isOn;
            }
            else
            {
                if (isOn)
                {
                    isOn = false;
                }
                else
                {
                    isOn = true;
                }
            }

            if (toggleType == AC_ToggleType.Subtitles)
            {
                Options.optionsData.showSubtitles = isOn;
                Options.SavePrefs();
            }
            else if (toggleType == AC_ToggleType.Variable)
            {
                if (varID >= 0)
                {
                    GVar var = RuntimeVariables.GetVariable(varID);
                    if (var.type == VariableType.Boolean)
                    {
                        if (isOn)
                        {
                            var.val = 1;
                        }
                        else
                        {
                            var.val = 0;
                        }
                        var.Upload();
                    }
                }
            }

            if (toggleType == AC_ToggleType.CustomScript)
            {
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
            }

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset(actionListOnClick);
            }
        }
コード例 #8
0
ファイル: RuntimeVariables.cs プロジェクト: IJkeB/Ekster1
 public static bool GetBooleanValue(int _id)
 {
     if (RuntimeVariables.GetVariable(_id).val == 1)
     {
         return(true);
     }
     return(false);
 }
コード例 #9
0
        override public ActionEnd End(List <Action> actions)
        {
            if (numSockets <= 0)
            {
                Debug.LogWarning("Could not compute Random check because no values were possible!");
                return(GenerateStopActionEnd());
            }

            if (variableID == -1)
            {
                return(GenerateStopActionEnd());
            }

            GVar var = null;

            if (location == VariableLocation.Local && !isAssetFile)
            {
                var = LocalVariables.GetVariable(variableID);
            }
            else
            {
                var = RuntimeVariables.GetVariable(variableID);
            }

            if (var != null)
            {
                if (var.type == VariableType.Integer)
                {
                    var.Download();
                    if (var.val < 1)
                    {
                        var.val = 1;
                    }
                    int originalValue = var.val - 1;
                    var.val++;
                    if (var.val > numSockets)
                    {
                        if (doLoop)
                        {
                            var.val = 1;
                        }
                        else
                        {
                            var.val = numSockets;
                        }
                    }
                    var.Upload();
                    return(ProcessResult(originalValue, actions));
                }
                else
                {
                    Debug.LogWarning("Variable: Run sequence Action is referencing a Variable that does not exist!");
                }
            }

            return(GenerateStopActionEnd());
        }
コード例 #10
0
ファイル: RuntimeVariables.cs プロジェクト: IJkeB/Ekster1
 public static void SetBooleanValue(int _id, bool _value)
 {
     if (_value)
     {
         RuntimeVariables.GetVariable(_id).val = 1;
     }
     else
     {
         RuntimeVariables.GetVariable(_id).val = 0;
     }
 }
コード例 #11
0
 override public void Skip()
 {
     if (variableID != -1)
     {
         if (location == VariableLocation.Local && !isAssetFile)
         {
             SetVariable(LocalVariables.GetVariable(variableID), VariableLocation.Local, true);
         }
         else
         {
             SetVariable(RuntimeVariables.GetVariable(variableID), VariableLocation.Global, true);
         }
     }
 }
コード例 #12
0
ファイル: MenuSlider.cs プロジェクト: IJkeB/Ekster_Final
        private void CalculateValue()
        {
            if (!Application.isPlaying)
            {
                return;
            }

            if (sliderType == AC_SliderType.Speech || sliderType == AC_SliderType.SFX || sliderType == AC_SliderType.Music)
            {
                if (Options.optionsData != null)
                {
                    if (sliderType == AC_SliderType.Speech)
                    {
                        amount = Options.optionsData.speechVolume;
                    }
                    else if (sliderType == AC_SliderType.Music)
                    {
                        amount = Options.optionsData.musicVolume;
                    }
                    else if (sliderType == AC_SliderType.SFX)
                    {
                        amount = Options.optionsData.sfxVolume;
                    }
                }
            }
            else if (sliderType == AC_SliderType.FloatVariable)
            {
                if (varID >= 0)
                {
                    GVar _variable = RuntimeVariables.GetVariable(varID);
                    if (_variable != null)
                    {
                        if (_variable.type != VariableType.Float)
                        {
                            Debug.LogWarning("Cannot link MenuSlider " + title + " to Variable " + varID + " as it is not a Float.");
                        }
                        else
                        {
                            amount = Mathf.Clamp(RuntimeVariables.GetFloatValue(varID), 0f, 1f);
                        }
                    }
                    else
                    {
                        Debug.LogWarning("Slider " + this.label + " is referencing Gloval Variable " + varID + ", which does not exist.");
                    }
                }
            }
        }
コード例 #13
0
        override public float Run()
        {
            if (variableID != -1)
            {
                if (location == VariableLocation.Local && !isAssetFile)
                {
                    SetVariable(LocalVariables.GetVariable(variableID), VariableLocation.Local, false);
                }
                else
                {
                    SetVariable(RuntimeVariables.GetVariable(variableID), VariableLocation.Global, false);
                }
            }

            return(0f);
        }
コード例 #14
0
        public static void SavePrefs()
        {
            if (Application.isPlaying)
            {
                // Linked Variables
                RuntimeVariables.DownloadAll();
                optionsData.linkedVariables = SaveSystem.CreateVariablesData(KickStarter.runtimeVariables.globalVars, true, VariableLocation.Global);
            }

            SavePrefsToID(GetActiveProfileID(), null, true);

            if (Application.isPlaying)
            {
                KickStarter.options.CustomSaveOptionsHook();
            }
        }
コード例 #15
0
ファイル: MenuCycle.cs プロジェクト: IJkeB/Ekster_Final
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (KickStarter.stateHandler.gameState == GameState.Cutscene)
            {
                return;
            }

            base.ProcessClick(_menu, _slot, _mouseState);

            selected++;
            if (selected > optionsArray.Count - 1)
            {
                selected = 0;
            }

            if (cycleType == AC_CycleType.Language)
            {
                if (selected == 0 && KickStarter.speechManager.ignoreOriginalText && KickStarter.speechManager.languages.Count > 1)
                {
                    // Ignore original text by skipping to first language
                    selected = 1;
                }
                Options.SetLanguage(selected);
            }
            else if (cycleType == AC_CycleType.Variable)
            {
                if (varID >= 0)
                {
                    GVar var = RuntimeVariables.GetVariable(varID);
                    if (var.type == VariableType.Integer)
                    {
                        var.val = selected;
                        var.Upload();
                    }
                }
            }

            if (cycleType == AC_CycleType.CustomScript)
            {
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
            }

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset(actionListOnClick);
            }
        }
コード例 #16
0
        /**
         * <summary>Unsets the values of all script variables, so that they can be re-assigned to the correct scene if multiple scenes are open.</summary>
         */
        public void ClearVariables()
        {
            playerPrefab           = null;
            mainCameraPrefab       = null;
            persistentEnginePrefab = null;
            gameEnginePrefab       = null;

            // Managers
            sceneManagerPrefab     = null;
            settingsManagerPrefab  = null;
            actionsManagerPrefab   = null;
            variablesManagerPrefab = null;
            inventoryManagerPrefab = null;
            speechManagerPrefab    = null;
            cursorManagerPrefab    = null;
            menuManagerPrefab      = null;

            // PersistentEngine components
            optionsComponent                = null;
            runtimeInventoryComponent       = null;
            runtimeVariablesComponent       = null;
            playerMenusComponent            = null;
            stateHandlerComponent           = null;
            sceneChangerComponent           = null;
            saveSystemComponent             = null;
            levelStorageComponent           = null;
            runtimeLanguagesComponent       = null;
            actionListAssetManagerComponent = null;

            // GameEngine components
            menuSystemComponent        = null;
            dialogComponent            = null;
            playerInputComponent       = null;
            playerInteractionComponent = null;
            playerMovementComponent    = null;
            playerCursorComponent      = null;
            playerQTEComponent         = null;
            sceneSettingsComponent     = null;
            navigationManagerComponent = null;
            actionListManagerComponent = null;
            localVariablesComponent    = null;
            menuPreviewComponent       = null;
            eventManagerComponent      = null;

            SetGameEngine();
        }
コード例 #17
0
        public void SavePrefs()
        {
            // Linked Variables
            RuntimeVariables.DownloadAll();
            optionsData.linkedVariables = SaveSystem.CreateVariablesData(KickStarter.runtimeVariables.globalVars, true, VariableLocation.Global);

            string optionsBinary = Serializer.SerializeObjectBinary(optionsData);

            PlayerPrefs.SetString(ppKey, optionsBinary);

            if (Application.isPlaying)
            {
                CustomSaveOptionsHook();
            }

            Debug.Log("PlayerPrefs saved.");
        }
コード例 #18
0
        override public ActionEnd End(List <AC.Action> actions)
        {
            if (variableID == -1)
            {
                return(GenerateStopActionEnd());
            }

            GVar compareVar = null;

            if (getVarMethod == GetVarMethod.GlobalVariable || getVarMethod == GetVarMethod.LocalVariable)
            {
                if (compareVariableID == -1)
                {
                    return(GenerateStopActionEnd());
                }

                if (getVarMethod == GetVarMethod.GlobalVariable)
                {
                    compareVar = RuntimeVariables.GetVariable(compareVariableID);
                    compareVar.Download();
                }
                else if (getVarMethod == GetVarMethod.LocalVariable && !isAssetFile)
                {
                    compareVar = LocalVariables.GetVariable(compareVariableID);
                }
            }

            if (location == VariableLocation.Local && !isAssetFile)
            {
                return(ProcessResult(CheckCondition(LocalVariables.GetVariable(variableID), compareVar), actions));
            }

            else
            {
                GVar var = RuntimeVariables.GetVariable(variableID);
                if (var != null)
                {
                    var.Download();
                    return(ProcessResult(CheckCondition(var, compareVar), actions));
                }
                return(GenerateStopActionEnd());
            }
        }
コード例 #19
0
ファイル: MenuLabel.cs プロジェクト: IJkeB/Ekster1
        public override string GetLabel(int slot, int languageNumber)
        {
            if (labelType == AC_LabelType.Normal)
            {
                return(TranslateLabel(label, languageNumber));
            }
            else if (labelType == AC_LabelType.DialogueSpeaker)
            {
                return(KickStarter.dialog.GetSpeaker());
            }
            else if (labelType == AC_LabelType.GlobalVariable)
            {
                return(RuntimeVariables.GetVariable(variableID).GetValue());
            }
            else if (labelType == AC_LabelType.Hotspot)
            {
                return(KickStarter.playerMenus.GetHotspotLabel());
            }

            return("");
        }
コード例 #20
0
ファイル: RuntimeVariables.cs プロジェクト: IJkeB/Ekster1
 public static void SetStringValue(int _id, string _value)
 {
     RuntimeVariables.GetVariable(_id).textVal = _value;
 }
コード例 #21
0
ファイル: KickStarter.cs プロジェクト: mcbodge/eidolon
        /**
         * <summary>Unsets the values of all script variables, so that they can be re-assigned to the correct scene if multiple scenes are open.</summary>
         */
        public void ClearVariables()
        {
            playerPrefab = null;
            mainCameraPrefab = null;
            persistentEnginePrefab = null;
            gameEnginePrefab = null;

            // Managers
            sceneManagerPrefab = null;
            settingsManagerPrefab = null;
            actionsManagerPrefab = null;
            variablesManagerPrefab = null;
            inventoryManagerPrefab = null;
            speechManagerPrefab = null;
            cursorManagerPrefab = null;
            menuManagerPrefab = null;

            // PersistentEngine components
            optionsComponent = null;
            runtimeInventoryComponent = null;
            runtimeVariablesComponent = null;
            playerMenusComponent = null;
            stateHandlerComponent = null;
            sceneChangerComponent = null;
            saveSystemComponent = null;
            levelStorageComponent = null;
            runtimeLanguagesComponent = null;

            // GameEngine components
            menuSystemComponent = null;
            dialogComponent = null;
            playerInputComponent = null;
            playerInteractionComponent = null;
            playerMovementComponent = null;
            playerCursorComponent = null;
            playerQTEComponent = null;
            sceneSettingsComponent = null;
            navigationManagerComponent = null;
            actionListManagerComponent = null;
            localVariablesComponent = null;
            menuPreviewComponent = null;

            SetGameEngine ();
        }
コード例 #22
0
ファイル: RuntimeVariables.cs プロジェクト: IJkeB/Ekster1
 public static int GetIntegerValue(int _id)
 {
     return(RuntimeVariables.GetVariable(_id).val);
 }
コード例 #23
0
ファイル: RuntimeVariables.cs プロジェクト: IJkeB/Ekster1
 public static string GetStringValue(int _id)
 {
     return(RuntimeVariables.GetVariable(_id).textVal);
 }
コード例 #24
0
ファイル: MenuLabel.cs プロジェクト: IJkeB/Ekster1
        public override void PreDisplay(int _slot, int languageNumber, bool isActive)
        {
            if (Application.isPlaying)
            {
                if (labelType == AC_LabelType.Hotspot)
                {
                    if (KickStarter.playerMenus.GetHotspotLabel() != "" || updateIfEmpty)
                    {
                        newLabel = KickStarter.playerMenus.GetHotspotLabel();
                    }
                }
                else if (labelType == AC_LabelType.Normal)
                {
                    newLabel = TranslateLabel(label, languageNumber);
                }
                else if (labelType == AC_LabelType.GlobalVariable)
                {
                    newLabel = RuntimeVariables.GetVariable(variableID).GetValue();
                }
                else
                {
                    UpdateSpeechLink();

                    if (labelType == AC_LabelType.DialogueLine)
                    {
                        if (speech != null)
                        {
                            string line = speech.displayText;
                            if (line != "" || updateIfEmpty)
                            {
                                newLabel = line;
                            }

                            if (useCharacterColour)
                            {
                                speechColour = speech.GetColour();
                                if (uiText)
                                {
                                    uiText.color = speechColour;
                                }
                            }
                        }
                        else if (!KickStarter.speechManager.keepTextInBuffer)
                        {
                            newLabel = "";
                        }
                    }
                    else if (labelType == AC_LabelType.DialogueSpeaker)
                    {
                        if (speech != null)
                        {
                            string line = speech.GetSpeaker();

                            if (line != "" || updateIfEmpty)
                            {
                                newLabel = line;
                            }
                        }
                        else if (!KickStarter.speechManager.keepTextInBuffer)
                        {
                            newLabel = "";
                        }
                    }
                }
            }
            else
            {
                newLabel = label;
            }

            newLabel = AdvGame.ConvertTokens(newLabel);

            if (uiText != null)
            {
                uiText.text = newLabel;
                UpdateUIElement(uiText);
            }
        }
コード例 #25
0
ファイル: RuntimeVariables.cs プロジェクト: IJkeB/Ekster1
 public static float GetFloatValue(int _id)
 {
     return(RuntimeVariables.GetVariable(_id).floatVal);
 }
コード例 #26
0
ファイル: RuntimeVariables.cs プロジェクト: IJkeB/Ekster1
 public static void SetFloatValue(int _id, float _value)
 {
     RuntimeVariables.GetVariable(_id).floatVal = _value;
 }
コード例 #27
0
ファイル: RuntimeVariables.cs プロジェクト: IJkeB/Ekster1
 public static string GetPopupValue(int _id)
 {
     return(RuntimeVariables.GetVariable(_id).GetValue());
 }
コード例 #28
0
ファイル: MenuSlider.cs プロジェクト: IJkeB/Ekster_Final
        private void UpdateValue()
        {
            if (uiSlider == null)
            {
                if (amount < 0f)
                {
                    amount = 0;
                }
                else if (amount > 1f)
                {
                    amount = 1f;
                }

                // Limit by steps
                if (numberOfSteps > 0)
                {
                    float valueSeparation = 1f / (float)numberOfSteps;
                    float nearestValue    = 0f;
                    while (nearestValue < amount)
                    {
                        nearestValue += valueSeparation;
                    }

                    // Now larger than amount, so which is closer?
                    float lowerNearest = nearestValue - valueSeparation;
                    if (amount - lowerNearest > nearestValue - amount)
                    {
                        amount = nearestValue;
                    }
                    else
                    {
                        amount = lowerNearest;
                    }
                }
            }

            if (sliderType == AC_SliderType.Speech || sliderType == AC_SliderType.SFX || sliderType == AC_SliderType.Music)
            {
                if (Options.optionsData != null)
                {
                    if (sliderType == AC_SliderType.Speech)
                    {
                        Options.optionsData.speechVolume = amount;
                    }
                    else if (sliderType == AC_SliderType.Music)
                    {
                        Options.optionsData.musicVolume = amount;
                        KickStarter.options.SetVolume(SoundType.Music);
                    }
                    else if (sliderType == AC_SliderType.SFX)
                    {
                        Options.optionsData.sfxVolume = amount;
                        KickStarter.options.SetVolume(SoundType.SFX);
                    }

                                        #if UNITY_5
                    if (sliderType == AC_SliderType.Speech)
                    {
                        AdvGame.SetMixerVolume(KickStarter.settingsManager.speechMixerGroup, KickStarter.settingsManager.speechAttentuationParameter, amount);
                    }
                    else if (sliderType == AC_SliderType.Music)
                    {
                        AdvGame.SetMixerVolume(KickStarter.settingsManager.musicMixerGroup, KickStarter.settingsManager.musicAttentuationParameter, amount);
                    }
                    else if (sliderType == AC_SliderType.SFX)
                    {
                        AdvGame.SetMixerVolume(KickStarter.settingsManager.sfxMixerGroup, KickStarter.settingsManager.sfxAttentuationParameter, amount);
                    }
                                        #endif

                    Options.SavePrefs();
                }
                else
                {
                    Debug.LogWarning("Could not find Options data!");
                }
            }
            else if (sliderType == AC_SliderType.FloatVariable)
            {
                if (varID >= 0)
                {
                    GVar var = RuntimeVariables.GetVariable(varID);
                    if (var.type == VariableType.Float)
                    {
                        var.floatVal = amount;
                        var.Upload();
                    }
                }
            }
        }
コード例 #29
0
ファイル: RuntimeVariables.cs プロジェクト: IJkeB/Ekster1
 public static void SetPopupValue(int _id, int _value)
 {
     RuntimeVariables.GetVariable(_id).val = _value;
 }