void OnEnable() { var root = rootVisualElement; // Import UXML var uxmlPath = $"{m_WindowUIFilesRootPath}/PackageSettingsWindow.uxml"; var visualTree = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(uxmlPath); var template = visualTree.CloneTree(); m_WindowRoot = template[0]; root.Add(m_WindowRoot); var packageInfo = GetPackageInfo(); root.Q <Label>("displayName").text = packageInfo.displayName.TrimStart("Stans Assets - "); root.Q <Label>("description").text = packageInfo.description; root.Q <Label>("version").text = $"Version: {packageInfo.version}"; m_TabsButtons = root.Q <ButtonStrip>(); m_TabsButtons.CleanUp(); m_TabsButtons.OnButtonClick += ActivateTab; OnWindowEnable(root); ActivateTab(); }
void OnEnable() { // This is a workaround due to a very weird bug. // During OnEnable we may need to accesses singleton scriptable object associated with the package. // And looks like AssetDatabase could be not ready and we will recreate new empty settings objects // instead of getting existing one. EditorApplication.delayCall += () => { var root = rootVisualElement; UIToolkitEditorUtility.CloneTreeAndApplyStyle(root, $"{m_WindowUIFilesRootPath}/PackageSettingsWindow"); m_TabsContainer = root.Q <ScrollView>("tabs-container"); var packageInfo = GetPackageInfo(); root.Q <Label>("display-name").text = packageInfo.displayName.Remove(0, "Stans Assets - ".Length); root.Q <Label>("description").text = packageInfo.description; root.Q <Label>("version").text = $"Version: {packageInfo.version}"; m_TabsButtons = root.Q <ButtonStrip>(); m_TabsButtons.CleanUp(); m_TabsButtons.OnButtonClick += ActivateTab; OnWindowEnable(root); ActivateTab(); }; }
private void abilityButtonPressed(FButton b) { Debug.Log("[[Ability Button Pressed]]: Actor " + this.SelectedActor + ", Ability " + b.data); var ability = b.data as Ability; var controller = ability.GetController(); controller.ActionComplete += actionComplete; this.mapContainer.RemoveChild(this.buttonStrip); this.buttonStrip = null; this.SelectedActor.TurnState = ActorState.ExecutingCommand; controller.Activate(ability); }
void OnEnable() { var root = rootVisualElement; UIToolkitEditorUtility.CloneTreeAndApplyStyle(root, $"{m_WindowUIFilesRootPath}/PackageSettingsWindow"); m_TabsContainer = root.Q <ScrollView>("tabs-container"); var packageInfo = GetPackageInfo(); root.Q <Label>("display-name").text = packageInfo.displayName.Remove(0, "Stans Assets - ".Length); root.Q <Label>("description").text = packageInfo.description; root.Q <Label>("version").text = $"Version: {packageInfo.version}"; m_TabsButtons = root.Q <ButtonStrip>(); m_TabsButtons.CleanUp(); m_TabsButtons.OnButtonClick += ActivateTab; OnWindowEnable(root); ActivateTab(); }
private void showButtonStrip(Actor actor) { this.buttonStrip = new ButtonStrip(); this.buttonStrip.Orientation = ButtonStripOrientation.Horizontal; this.buttonStrip.Spacing = 3.0f; if (actor != null && actor.TurnState == ActorState.AwaitingCommand) { foreach (var ability in actor.Properties.AvailableAbilities) { var button = new FButton(ability.IconName); button.sprite.width = button.sprite.height = 32; button.data = ability; button.SignalRelease += new Action <FButton>(abilityButtonPressed); this.buttonStrip.AddButton(button); } } this.buttonStrip.x = actor.x + actor.width; this.buttonStrip.y = actor.y - actor.height; this.mapContainer.AddChild(this.buttonStrip); }
private void showButtonStrip(Actor actor) { this.buttonStrip = new ButtonStrip(); this.buttonStrip.Orientation = ButtonStripOrientation.Horizontal; this.buttonStrip.Spacing = 3.0f; if (actor != null && actor.TurnState == ActorState.AwaitingCommand) { if (!actor.HasMovedThisTurn) { this.buttonStrip.AddButton(this.moveButton); } this.buttonStrip.AddButton(this.attackButton); this.buttonStrip.AddButton(this.waitButton); this.buttonStrip.isVisible = true; this.buttonStrip.x = actor.x + actor.width; this.buttonStrip.y = actor.y - actor.height; this.AddChild(this.buttonStrip); } }
private void showButtonStrip(Actor actor) { this.buttonStrip = new ButtonStrip(); this.buttonStrip.Orientation = ButtonStripOrientation.Horizontal; this.buttonStrip.Spacing = 3.0f; if (actor != null && actor.TurnState == ActorState.AwaitingCommand) { foreach (var ability in actor.Properties.AvailableAbilities) { var button = new FButton(ability.IconName); button.sprite.width = button.sprite.height = 32; button.data = ability; button.SignalRelease += new Action<FButton>(abilityButtonPressed); this.buttonStrip.AddButton(button); } } this.buttonStrip.x = actor.x + actor.width; this.buttonStrip.y = actor.y - actor.height; this.mapContainer.AddChild(this.buttonStrip); }