/// <summary> /// Sets state of translator. /// </summary> public void SetState(bool state) { if (State == state) { return; } if (Target == null) { Target = GetComponent <RectTransform>(); } State = state; JEMTranslatorScript.RegenerateLocalScript(); if (UpdatePosition) { if (SlavePosition != null) { JEMTranslatorScript.Script.StopCoroutine(SlavePosition); } SlavePosition = JEMTranslatorScript.Script.StartCoroutine( JEMTranslatorScript.Script.RectSlavePosition(this, state)); } if (UpdateSize) { if (SlaveSize != null) { JEMTranslatorScript.Script.StopCoroutine(SlaveSize); } SlaveSize = JEMTranslatorScript.Script.StartCoroutine(JEMTranslatorScript.Script.RectSlaveSize(this, state)); } }
/// <summary> /// Prepares JEM to work. /// It mainly creates all scripts that are used by systems and need to use IEnumenator. /// </summary> public static void PrepareJEM() { var sw = Stopwatch.StartNew(); JEMLogger.Init(); JEMOperation.RegenerateLocalScript(); JEMGameResources.RegenerateLocalScript(); JEMInterfaceFadeElement.RegenerateLocalScript(); JEMInterfaceFadeAnimation.RegenerateLocalScript(); JEMTranslatorScript.RegenerateLocalScript(); JEMExtensionAudioSource.RegenerateLocalScript(); JEMExtensionGameObject.RegenerateLocalScript(); JEMExtensionText.RegenerateLocalScript(); sw.Stop(); JEMLogger.InternalLog($"JEM prepare took {sw.Elapsed.TotalSeconds:0.00} seconds."); }