예제 #1
0
        public async Task InitializeServiceAsync()
        {
            scriptLoader = new ScriptLoader(config.Loader, providersManager, localizationManager);

            if (!string.IsNullOrEmpty(config.GlobalDefinesScript))
            {
                scriptLoader.GlobalDefinesScript = await scriptLoader.LoadAsync(config.GlobalDefinesScript);
            }

            if (CommunityModdingEnabled)
            {
                externalScriptLoader = new ScriptLoader(config.ExternalLoader, providersManager, localizationManager);
                externalScriptLoader.GlobalDefinesScript = scriptLoader.GlobalDefinesScript;
            }

            if (Application.isPlaying && config.EnableNavigator)
            {
                var navigatorPrefab = Resources.Load <UI.ScriptNavigatorPanel>(navigatorPrefabResourcesPath);
                navigatorUI = Engine.Instantiate(navigatorPrefab, "ScriptNavigator");
                navigatorUI.SortingOrder = config.NavigatorSortOrder;
                navigatorUI.SetIsVisible(false);
            }

            if (string.IsNullOrEmpty(config.StartGameScript))
            {
                var scriptPaths = await scriptLoader.LocateAsync(string.Empty);

                StartGameScriptName = scriptPaths.FirstOrDefault()?.Replace(scriptLoader.PathPrefix + "/", string.Empty);
            }
            else
            {
                StartGameScriptName = config.StartGameScript;
            }
        }
예제 #2
0
 public virtual void Initialize(ScriptNavigatorPanel navigator, string scriptName, IScriptPlayer player)
 {
     this.navigator  = navigator;
     this.scriptName = scriptName;
     this.player     = player;
     name            = "PlayScript: " + scriptName;
     SetLabel(scriptName);
     isInitialized            = true;
     UIComponent.interactable = true;
 }
예제 #3
0
        protected override void Awake()
        {
            base.Awake();

            syncImage = GetComponentInChildren <Image>();
            panel     = GetComponentInParent <ScriptNavigatorPanel>();
            this.AssertRequiredObjects(syncImage, panel);

            scriptManager            = Engine.GetService <IScriptManager>();
            UIComponent.interactable = false;
        }
 public virtual void Initialize(ScriptNavigatorPanel navigator, Script script, IScriptPlayer player)
 {
     this.navigator = navigator;
     this.script    = script;
     this.player    = player;
     name           = "PlayScript: " + script.Name;
     if (labelText)
     {
         labelText.text = script.Name;
     }
     isInitialized            = true;
     UIComponent.interactable = true;
 }