public void Render(IUIContainer container) { _stackPanel = container.GetInterface<IStackPanel>(); if (!_stackPanel.DisplaySummary) { if (_hasChildren == null) return; var scrollViewer = new ScrollViewer(); var newStackPanel = new StackPanel(); scrollViewer.Content = newStackPanel; scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; var newStackPanelWrapper = new StackPanelWrapper(newStackPanel, scrollViewer, true); foreach (var child in _hasChildren.UIElements) { if (child == null) continue; child.Render(newStackPanelWrapper); } _stackPanel.AddChild(scrollViewer); var grid = (Grid) ((StackPanel) scrollViewer.Parent).Parent; var parent = (Window)grid.Parent; parent.SizeChanged += ParentSizeChanged; } else { if (_block.Parent != null) ((StackPanel)_block.Parent).Children.Remove(_block); _stackPanel.AddChild(_block); } }
public CombatUI(ICombatController combatController, IUICharacterManager uiCharacterManager, GameUIConstants gameUIConstants, IUIContainer uiContainer, UserInput userInput, IUIStateTracker defaultsHandler, IDisplayManager displayManager, IDisplayCombatState combatStateHandler) { _combatController = combatController; _displayManager = displayManager; _combatStateHandler = combatStateHandler; _defaultsHandler = defaultsHandler; _uiCharacterManager = uiCharacterManager; _uiCharacterManager.Characters = _displayManager.GetDisplayCharacters(); _uiCharacterManager.CurrentRoundOrderIds = _combatStateHandler.GetRoundOrderIds()[0]; _uiCharacterManager.NextRoundOrderIds = _combatStateHandler.GetRoundOrderIds()[1]; _uiContainer = uiContainer; _userInput = userInput; BindEvents(); RefreshActionPanelList(); }
public UIControl(IUIContainer container, By by, int?index = null) : base(container?.FramePath, container, by) { this.Container = container; this.by = by; this.Index = index; }
/// <summary> /// 关闭UI后执行一个回调 /// </summary> /// <param name="uiName">UI名字</param> /// <param name="callback">关闭回调</param> public void CloseWithCallback(string uiName, Action callback) { UIContext uiContext = FindUIContext(uiName); if (uiContext != null) { IUIContainer uiContainer = null; if (showDic.TryGetValue(uiContext.UIData.UIType, out uiContainer)) { if (uiContainer is UIStackContainer) { //当前UI在栈顶才能被关闭 UIStackContainer uiStackContainer = uiContainer as UIStackContainer; string topUiName = uiStackContainer.Peek(); if (topUiName == uiName) { uiContainer?.Pop(callback); } } else { uiContainer?.Close(uiName, callback); } } } }
public void Render(IUIContainer container) { _stackPanel = container.GetInterface<IStackPanel>(); if (!_stackPanel.DisplaySummary) { if (_fileInfo.Extension == ".jpg") { var image = new Image {Source = new BitmapImage(new Uri(_fileInfo.FullName))}; _stackPanel.AddChild(image); } else { if (_bodyBlock.Parent != null) ((StackPanel)_bodyBlock.Parent).Children.Remove(_bodyBlock); _stackPanel.AddChild(_bodyBlock); } } else { if (_block.Parent != null) ((StackPanel)_block.Parent).Children.Remove(_block); _stackPanel.AddChild(_block); } }
public void Setup(object itemData, IUIContainer c) { data = itemData as BaseCard; container = c; cardNameLabel.text = data.key; view.sprite = SpriteBase.GetSprite(data.view + data.teamId.ToString()); summonCostLabel.text = data.summonCost.ToString(); }
/// <summary> /// 关闭指定类型的栈所有界面,然后打开下一个界面(无缝切换) /// </summary> /// <param name="uiType">关闭的栈类型</param> /// <param name="uiName">UI名字</param> /// <param name="args">传递到0nStart的参数</param> public void PopAllThenOpen(UIType uiType, string uiName, params object[] args) { IUIContainer uiContainer = null; if (showDic.TryGetValue(uiType, out uiContainer)) { uiContainer?.PopAllThenOpen(uiName, args); } }
/// <summary> /// UI退栈并执行回调 /// </summary> /// <param name="uiType">UI类型</param> /// <param name="callback">回调</param> public void PopWithCallback(UIType uiType, Action callback) { IUIContainer uiContainer = null; if (showDic.TryGetValue(uiType, out uiContainer)) { uiContainer?.Pop(callback); } }
/// <summary> /// 关闭栈顶界面 /// </summary> /// <param name="uiType">ui类型</param> public void Pop(UIType uiType) { IUIContainer uiContainer = null; if (showDic.TryGetValue(uiType, out uiContainer)) { uiContainer?.Pop(null); } }
public void Render(IUIContainer container) { var stackPanel = container.GetInterface<IStackPanel>(); if (!stackPanel.DisplaySummary) return; if (_summaryBlock.Parent != null) ((StackPanel) _summaryBlock.Parent).Children.Remove(_summaryBlock); stackPanel.AddChild(_summaryBlock); }
public void Render(IUIContainer container) { _stackPanel = container.GetInterface<IStackPanel>(); var block = _stackPanel.DisplaySummary ? _summaryBlock : _bodyBlock; if (block.Parent != null) ((StackPanel)block.Parent).Children.Remove(block); _stackPanel.AddChild(block); }
public UI Open(string uiName, IUIContainer container) { UI ui = AssetsAgent.GetGameObject(uiName, container.UIContainer).GetComponent <UI>(); if (ui.Canvas.isRootCanvas) { ui.Canvas.sortingOrder = ui.transform.GetSiblingIndex(); } ui.Parent = container; return(ui); }
public UserInput(IUIStateTracker defaultsHandler, IUIContainer uiContainer, IUICharacterManager uiCharacterManager, GameUIConstants gameUIConstants) { _defaultsHandler = defaultsHandler; _uiContainer = uiContainer; _uiCharacterManager = uiCharacterManager; _gameUIConstants = gameUIConstants; BindEvents(); }
public UIContainer(string framePath, IUIContainer parent = null, By rootBy = null) { ByOfRoot = rootBy ?? DefaultByOfRoot; string path = (parent == null) ? "" : parent.FramePath; if (!string.IsNullOrEmpty(framePath)) { path = WebDriverManager.FrameIndicator + framePath; } string[] targetFrames = path.Split(new char[] { ' ', '>', '$', '%' }, StringSplitOptions.RemoveEmptyEntries); FramePath = string.Join(WebDriverManager.FrameIndicator, targetFrames); ThisFrameName = targetFrames.Length > 0 ? targetFrames.Last() : ""; }
/// <summary> /// Initializes the specified session. /// </summary> /// <param name="session">The session.</param> /// <param name="resourcePath">The resource path.</param> /// <param name="uiLevel">The UI level.</param> /// <returns></returns> /// <exception cref="Microsoft.Deployment.WindowsInstaller.InstallCanceledException"></exception> public bool Initialize(Session session, string resourcePath, ref InstallUIOptions uiLevel) { //System.Diagnostics.Debugger.Launch(); if (session != null && (session.IsUninstalling() || uiLevel.IsBasic())) { return(false); //use built-in MSI basic UI } try { ReadDialogs(session); var startEvent = new ManualResetEvent(false); var uiThread = new Thread(() => { shell = new UIShell(); //important to create the instance in the same thread that call ShowModal shell.ShowModal(new MsiRuntime(session) { StartExecute = () => startEvent.Set() }, this); uiExitEvent.Set(); }); uiThread.SetApartmentState(ApartmentState.STA); uiThread.Start(); int waitResult = WaitHandle.WaitAny(new[] { startEvent, uiExitEvent }); if (waitResult == 1) { //UI exited without starting the install. Cancel the installation. throw new InstallCanceledException(); } else { // Start the installation with a silenced internal UI. // This "embedded external UI" will handle message types except for source resolution. uiLevel = InstallUIOptions.NoChange | InstallUIOptions.SourceResolutionOnly; shell.OnExecuteStarted(); return(true); } } catch (Exception e) { session.Log("Cannot attach ManagedUI: " + e); throw; } }
/// <summary> /// 打开UI /// </summary> /// <param name="uiName">UI名字</param> /// <param name="args">传递到0nStart的参数</param> public void Open(string uiName, params object[] args) { UIData uiData = FindUIData(uiName); if (uiData == null) { Debug.LogError($"{uiName}未注册"); return; } IUIContainer uiContainer = null; if (showDic.TryGetValue(uiData.UIType, out uiContainer)) { uiContainer?.Open(uiName, null, args); } }
/// <summary> /// 打开UI,完成后执行回调 /// </summary> /// <param name="uiName">UI名字</param> /// <param name="callback">回调</param> /// <param name="args">传递到0nStart的参数</param> public void OpenWithCallback(string uiName, Action <UI> callback, params object[] args) { UIData uiData = FindUIData(uiName); if (uiData == null) { Debug.LogError($"OpenWithCallbackAsync {uiName}未注册"); return; } IUIContainer uiContainer = null; if (showDic.TryGetValue(uiData.UIType, out uiContainer)) { uiContainer?.Open(uiName, callback, args); } }
protected void disposeDp() { bool flag = this._dpInfo.Count > 0 && this._dpSpr != null; if (flag) { foreach (string current in this._dpInfo.Keys) { Variant variant = this._dpInfo[current]; this._dpSpr.removeChild((variant["spr"]._val as _graphChaSprite).dispObj, false); (variant["spr"]._val as _graphChaSprite).dispose(); } } this._dpInfo = new Dictionary <string, Variant>(); this._dpSpr.visible = false; this._dpSpr = null; }
protected void _bindChildControls(Dictionary <string, IUIBaseControl> ctrlHost, IUIBaseControl ctrl) { IUIContainer iUIContainer = ctrl as IUIContainer; bool flag = iUIContainer == null; if (!flag) { for (int i = 0; i < iUIContainer.numChildren; i++) { IUIBaseControl child = iUIContainer.getChild(i); bool flag2 = ctrlHost.ContainsKey(child.id); if (!flag2) { ctrlHost[child.id] = child; this._bindChildControls(ctrlHost, child); } } } }
/// <summary> /// 通过名字删除UI /// </summary> /// <param name="uiName">UI名字</param> public void Remove(string uiName) { for (int i = 0, max = uiList.Count; i < max; i++) { UIContext tempUIContext = uiList[i]; if (tempUIContext != null && tempUIContext.UIData.UIName == uiName) { //清除显示容器数据 IUIContainer uiContainer = null; if (showDic.TryGetValue(tempUIContext.UIData.UIType, out uiContainer)) { uiContainer.Remove(uiName); } uiList.RemoveAt(i); //子UI一律销毁 if (tempUIContext.UIData.UIType == UIType.Child || tempUIContext.UIData.UICloseType == UICloseType.Destroy) { tempUIContext.TCS = null; if (tempUIContext.UI != null && tempUIContext.UI.UIState != UIStateType.Destroy) { tempUIContext.UI.Destroy(); } } else { //UI不销毁,直接回池 if (tempUIContext.UI.Transform) { tempUIContext.UI.Transform.SetParent(poolCanvas, false); } GameUI gameUI = tempUIContext.UI as GameUI; gameUI?.InPool(); poolDic.Add(tempUIContext.UIData.UIName, tempUIContext); } break; } } }
public bool RequestContainership(IUIContainer cont) { Transform parent = base.transform.parent; Transform transform = ((Component)cont).transform; while (parent != null) { if (parent == transform) { this.container = cont; return(true); } if (parent.gameObject.GetComponent("IUIContainer") != null) { return(false); } parent = parent.parent; } return(false); }
public static T GetScreen <T>(bool urlChangeExpected = true) where T : IUIContainer { Type t = typeof(T); IUIContainer screen; if (AllContainers == null) { AllContainers = new Dictionary <Type, IUIContainer>(); } if (!AllContainers.ContainsKey((t))) { if (!t.IsClass) { throw new ArgumentException( string.Format( "{0} is not class to be constructed, call SetScreen<T>(screen) first to setup the instance.", t)); } else if (null == t.GetConstructor(Type.EmptyTypes)) { throw new ArgumentException( string.Format( "{0} has no parameterless constructor, call SetScreen<T>(screen) first to setup the instance.", t)); } screen = Activator.CreateInstance <T>(); AllContainers.Add(t, screen); } screen = AllContainers[t]; if (urlChangeExpected && screen != lastScreen) { lastScreen = screen; WebDriverManager.WaitPageReady(1000); } return((T)screen); }
public bool RequestContainership(IUIContainer cont) { Transform t = transform.parent; Transform c = ((Component)cont).transform; while (t != null) { if (t == c) { container = cont; return(true); } else if (t.gameObject.GetComponent("IUIContainer") != null) { return(false); } t = t.parent; } // Never found *any* containers: return(false); }
public bool Initialize(Session session, string resourcePath, ref InstallUIOptions uiLevel) { Debugger.Launch(); if (session != null && (session.IsUninstalling() || uiLevel.IsBasic())) return false; //use built-in MSI basic UI ReadDialogs(session); var startEvent = new ManualResetEvent(false); var uiThread = new Thread(() => { shell = new UIShell(); //important to create the instance in the same thread that call ShowModal shell.ShowModal(new MsiRuntime(session) { StartExecute = () => startEvent.Set() }, this); uiExitEvent.Set(); }); uiThread.SetApartmentState(ApartmentState.STA); uiThread.Start(); int waitResult = WaitHandle.WaitAny(new[] { startEvent, uiExitEvent }); if (waitResult == 1) { //UI exited without starting the install. Cancel the installation. throw new InstallCanceledException(); } else { // Start the installation with a silenced internal UI. // This "embedded external UI" will handle message types except for source resolution. uiLevel = InstallUIOptions.NoChange | InstallUIOptions.SourceResolutionOnly; shell.OnExecuteStarted(); return true; } }
protected void _bindChildControls(Dictionary <string, IUIBaseControl> ctrlHost, IUIBaseControl ctrl) { IUIContainer container = ctrl as IUIContainer; if (container == null) { return; } for (int i = 0; i < container.numChildren; ++i) { IUIBaseControl child = container.getChild(i); if (ctrlHost.ContainsKey(child.id)) { continue; } ctrlHost[child.id] = child; //child.bindUI = this; this._bindChildControls(ctrlHost, child); } }
public void dispose() { this._disposed = true; this._aniSprites = null; this._chatSprites = null; bool flag = this._titleSpr != null; if (flag) { this._titleSpr.dispose(); this._titleSpr = null; } this._dynamicSpr = null; bool flag2 = this._titleSprites != null && this._titleSprites.Count > 0; if (flag2) { foreach (Variant current in this._titleSprites.Values) { foreach (Variant current2 in current["sprs"].Values) { (current2["spr"]._val as _graphChaSprite).dispose(); } } } this._titleSprites = null; this._titleOriData = null; this.disposeDp(); bool flag3 = this._groundSpr != null; if (flag3) { this._groundSpr.dispose(); } this._groundSpr = null; }
public UIControl(IUIContainer container, String by) : this(container, By.CssSelector(by)) { }
public UIControl(IUIContainer container, String by, int?index) : this(container, By.CssSelector(by), index) { }
public UIControl(IUIContainer container, By by) : this(container, by, null) { }
public UICheckBox(IUIContainer container, By by) : base(container, by) { }
/// <summary> /// Initializes the specified session. /// </summary> /// <param name="session">The session.</param> /// <param name="resourcePath">The resource path.</param> /// <param name="uiLevel">The UI level.</param> /// <returns></returns> /// <exception cref="Microsoft.Deployment.WindowsInstaller.InstallCanceledException"></exception> public bool Initialize(Session session, string resourcePath, ref InstallUIOptions uiLevel) { //System.Diagnostics.Debugger.Launch(); if (session != null && (session.IsUninstalling() || uiLevel.IsBasic())) { return(false); //use built-in MSI basic UI } string upgradeCode = session["UpgradeCode"]; using (cancelRequest) { try { ReadDialogs(session); var startEvent = new ManualResetEvent(false); var uiThread = new Thread(() => { session["WIXSHARP_MANAGED_UI"] = System.Reflection.Assembly.GetExecutingAssembly().ToString(); shell = new UIShell(); //important to create the instance in the same thread that call ShowModal shell.ShowModal(new MsiRuntime(session) { StartExecute = () => startEvent.Set(), CancelExecute = () => { // NOTE: IEmbeddedUI interface has no way to cancel the installation, which has been started // (e.g. ProgressDialog is displayed). What is even worse is that UI can pass back to here // a signal the user pressed 'Cancel' but nothing we can do with it. Install is already started // and session object is now invalid. // To solve this we use this work around - set a unique "cancel request mutex" form here // and ManagedProjectActions.CancelRequestHandler built-in CA will pick the request and yield // return code UserExit. cancelRequest = new Mutex(true, "WIXSHARP_UI_CANCEL_REQUEST." + upgradeCode); } }, this); uiExitEvent.Set(); }); uiThread.SetApartmentState(ApartmentState.STA); uiThread.Start(); int waitResult = WaitHandle.WaitAny(new[] { startEvent, uiExitEvent }); if (waitResult == 1) { //UI exited without starting the install. Cancel the installation. throw new InstallCanceledException(); } else { // Start the installation with a silenced internal UI. // This "embedded external UI" will handle message types except for source resolution. uiLevel = InstallUIOptions.NoChange | InstallUIOptions.SourceResolutionOnly; shell.OnExecuteStarted(); return(true); } } catch (Exception e) { session.Log("Cannot attach ManagedUI: " + e); throw; } } }
public UICheckBox(IUIContainer container, String by = "input[type='checkbox']") : this(container, By.CssSelector(by)) { }
public virtual void Copy(IControl ctl, ControlCopyFlags flags) { if (!(ctl is ControlBase)) { return; } ControlBase c = (ControlBase)ctl; // Copy transitions: if ((flags & ControlCopyFlags.Transitions) == ControlCopyFlags.Transitions) { if (c is UIStateToggleBtn3D) { if (c.Transitions != null) { ((UIStateToggleBtn3D)this).transitions = new EZTransitionList[c.Transitions.Length]; for (int i = 0; i < Transitions.Length; ++i) { c.Transitions[i].CopyToNew(Transitions[i], true); } } } else { if (Transitions != null && c.Transitions != null) { for (int i = 0; i < Transitions.Length && i < c.Transitions.Length; ++i) { c.Transitions[i].CopyTo(Transitions[i], true); } } } } if ((flags & ControlCopyFlags.Text) == ControlCopyFlags.Text) { // See if we want to clone the other // control's text mesh: if (spriteText == null && c.spriteText != null) { GameObject newText = (GameObject)Instantiate(c.spriteText.gameObject); newText.transform.parent = transform; newText.transform.localPosition = c.spriteText.transform.localPosition; newText.transform.localScale = c.spriteText.transform.localScale; newText.transform.localRotation = c.spriteText.transform.localRotation; } Text = c.Text; } if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance) { // See if we can copy the other control's collider's settings: if (collider.GetType() == c.collider.GetType()) { if (collider is BoxCollider) { BoxCollider bc1 = (BoxCollider)collider; BoxCollider bc2 = (BoxCollider)c.collider; bc1.center = bc2.center; bc1.size = bc2.size; } else if (collider is SphereCollider) { SphereCollider sc1 = (SphereCollider)collider; SphereCollider sc2 = (SphereCollider)c.collider; sc1.center = sc2.center; sc1.radius = sc2.radius; } else if (collider is CapsuleCollider) { CapsuleCollider cc1 = (CapsuleCollider)collider; CapsuleCollider cc2 = (CapsuleCollider)c.collider; cc1.center = cc2.center; cc1.radius = cc2.radius; cc1.height = cc2.height; cc1.direction = cc2.direction; } else if (collider is MeshCollider) { MeshCollider mc1 = (MeshCollider)collider; MeshCollider mc2 = (MeshCollider)c.collider; mc1.smoothSphereCollisions = mc2.smoothSphereCollisions; mc1.convex = mc2.convex; mc1.sharedMesh = mc2.sharedMesh; } collider.isTrigger = c.collider.isTrigger; } } if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation) { changeDelegate = c.changeDelegate; inputDelegate = c.inputDelegate; } if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State) { Container = c.Container; if (Application.isPlaying) { controlIsEnabled = c.controlIsEnabled; } } }
void Awake() { container = GetComponent <IUIContainer>(); container.OnItemClickAction += OnSelect; }
public AttShowStruct(IUIBaseControl disp, IUIContainer parent) { this._disp = disp; this._parent = parent; }
public bool RequestContainership(IUIContainer cont) { Transform t = transform.parent; Transform c = ((Component)cont).transform; while (t != null) { if (t == c) { Container = cont; return true; } else if (t.gameObject.GetComponent("IUIContainer") != null) return false; t = t.parent; } // Never found *any* containers: return false; }
public virtual void Copy(IControl ctl, ControlCopyFlags flags) { if (!(ctl is ControlBase)) return; ControlBase c = (ControlBase)ctl; // Copy transitions: if ((flags & ControlCopyFlags.Transitions) == ControlCopyFlags.Transitions) { if (c is UIStateToggleBtn3D) { if (c.Transitions != null) { ((UIStateToggleBtn3D)this).transitions = new EZTransitionList[c.Transitions.Length]; for (int i = 0; i < Transitions.Length; ++i) c.Transitions[i].CopyToNew(Transitions[i], true); } } else { if (Transitions != null && c.Transitions != null) for (int i = 0; i < Transitions.Length && i < c.Transitions.Length; ++i) c.Transitions[i].CopyTo(Transitions[i], true); } } if ((flags & ControlCopyFlags.Text) == ControlCopyFlags.Text) { // See if we want to clone the other // control's text mesh: if (spriteText == null && c.spriteText != null) { GameObject newText = (GameObject)Instantiate(c.spriteText.gameObject); newText.transform.parent = transform; newText.transform.localPosition = c.spriteText.transform.localPosition; newText.transform.localScale = c.spriteText.transform.localScale; newText.transform.localRotation = c.spriteText.transform.localRotation; } Text = c.Text; } if ((flags & ControlCopyFlags.Appearance) == ControlCopyFlags.Appearance) { // See if we can copy the other control's collider's settings: if (collider.GetType() == c.collider.GetType()) { if (collider is BoxCollider) { BoxCollider bc1 = (BoxCollider)collider; BoxCollider bc2 = (BoxCollider)c.collider; bc1.center = bc2.center; bc1.size = bc2.size; } else if (collider is SphereCollider) { SphereCollider sc1 = (SphereCollider)collider; SphereCollider sc2 = (SphereCollider)c.collider; sc1.center = sc2.center; sc1.radius = sc2.radius; } else if (collider is CapsuleCollider) { CapsuleCollider cc1 = (CapsuleCollider)collider; CapsuleCollider cc2 = (CapsuleCollider)c.collider; cc1.center = cc2.center; cc1.radius = cc2.radius; cc1.height = cc2.height; cc1.direction = cc2.direction; } else if (collider is MeshCollider) { MeshCollider mc1 = (MeshCollider)collider; MeshCollider mc2 = (MeshCollider)c.collider; mc1.smoothSphereCollisions = mc2.smoothSphereCollisions; mc1.convex = mc2.convex; mc1.sharedMesh = mc2.sharedMesh; } collider.isTrigger = c.collider.isTrigger; } } if ((flags & ControlCopyFlags.Invocation) == ControlCopyFlags.Invocation) { changeDelegate = c.changeDelegate; inputDelegate = c.inputDelegate; } if ((flags & ControlCopyFlags.State) == ControlCopyFlags.State) { Container = c.Container; if (Application.isPlaying) controlIsEnabled = c.controlIsEnabled; } }
public bool RequestContainership(IUIContainer cont) { Transform t = transform.parent; Transform c = ((Component)cont).transform; while (t != null) { if (t == c) { container = cont; return true; } else { #if UNITY_FLASH Component[] comps = t.gameObject.GetComponents<Component>(); foreach (Component cc in comps) { if (cc is IUIContainer) return false; } #else if (t.gameObject.GetComponent("IUIContainer") != null) return false; #endif } t = t.parent; } // Never found *any* containers: return false; }