private void Start() { gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); loadedResources = gameManager.GetComponent <LoadedResources>(); taskCreator = gameManager.GetComponent <TaskCreator>(); taskCreator.targets.Add(gameObject); // add ourselves to the list of targets in TaskCreator }
public void Reload(string filter) { var resourceToRemove = LoadedResources.AllLoaded.Where(v => v.Root != null && v.Root.Contains(filter)).ToArray(); foreach (var resToRemove in resourceToRemove) { LoadedResources.Unregister(resToRemove); } Reloaded?.Invoke(filter); }
// Use this for initialization void Start() { gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); chickenManager = gameManager.gameObject.GetComponent <ChickenManager>(); taskCreator = gameManager.gameObject.GetComponent <TaskCreator>(); loadedResources = gameManager.gameObject.GetComponent <LoadedResources>(); chicken = GetComponent <Chicken>(); ai = GetComponent <AIPath>(); if (age == 0) { birthMoment = gameManager.time; } }
// Use this for initialization void Start() { resources = GameObject.Find("LoadedResources").GetComponent <LoadedResources>(); tact = GameData.tact; float startDelay = 2f; //todo remove fixed delay lastTime = Time.time; checkTime = lastTime + startDelay; keyReleasedR = false; keyReleasedL = false; keyReleasedU = false; keyReleasedD = false; primKey = ' '; secKey = ' '; Invoke("RemoveInfo", startDelay); }
public new async Task<Script> LoadAsync (string path, bool isFullPath = false) { if (!isFullPath) path = BuildFullPath(path); var scriptName = path.Contains("/") ? path.GetAfter("/") : path; if (LocalizationManager is null || !await LocalizationManager.IsLocalizedResourceAvailableAsync<ScriptAsset>(path)) { var textResource = await base.LoadAsync(path, true); if (textResource is null || !textResource.IsValid || textResource.Object.ScriptText is null) { Debug.LogError($"Failed to load `{path}` naninovel script."); return null; } var script = new Script(scriptName, textResource.Object.ScriptText, GlobalDefinesScript?.DefineLines); LoadedScripts[path] = script; return script; } var sourceTextResource = await Providers.LoadResourceAsync<ScriptAsset>(path); if (sourceTextResource is null || !sourceTextResource.IsValid || sourceTextResource.Object.ScriptText is null) { Debug.LogError($"Failed to load source text of the `{path}` naninovel script."); return null; } LoadedResources.Add(sourceTextResource); var localizationTextResource = await base.LoadAsync(path, true); if (localizationTextResource is null || !localizationTextResource.IsValid || localizationTextResource.Object.ScriptText is null) { Debug.LogError($"Failed to load localization text of the `{path}` naninovel script."); return null; } var sourceScript = new Script(scriptName, sourceTextResource.Object.ScriptText, GlobalDefinesScript?.DefineLines); var localizationScript = new Script($"{scriptName}-{LocalizationManager.SelectedLocale}", localizationTextResource.Object.ScriptText, GlobalDefinesScript?.DefineLines); ScriptLocalization.LocalizeScript(sourceScript, localizationScript); LoadedScripts[path] = sourceScript; return sourceScript; }
public DefIDFull GetID(IDef res) => LoadedResources.GetID(res);
// Use this for initialization void Start() { resources = GameObject.Find("LoadedResources").GetComponent <LoadedResources>(); InfoSetup(); SetupScene(); }
private void OnDestroy() { //清空Resources字典 LoadedResources.Clear(); }