static public int GetRoot_s(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.GameObject a1; checkType(l, 1, out a1); var ret = NGUITools.GetRoot(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
Bounds bounds; // total bounds for all sprites. Calculated on Start() // =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== // =========================================================== // Methods // =========================================================== protected void Start() { var uiRoot = NGUITools.GetRoot(gameObject); guiCamera = uiRoot.GetComponentInChildren <Camera>(); RecalculateBounds(); }
void InitCompleted() { //Game start.Enable firstPersonPlayer's components.Disable Init Scene; NGUITools.GetRoot(gameObject).gameObject.SetActive(false); PersonArm.SetActive(true); GameObject.Find("firstPersonPlayer").GetComponent <MouseLook>().enabled = true; GameObject.Find("firstPersonPlayer").GetComponent <CharacterMotor>().enabled = true; }
void Start() { uiarray[0] = UI_Setting.GetInstance(); TweenAlpha.Begin(gameObject, 0.2f, 0.5f); root = NGUITools.GetRoot(gameObject).GetComponent <UIRoot>(); ratio = NGUITools.screenSize.y / root.manualHeight; range = ratio * range; }
private static int GetRoot(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); GameObject go = (GameObject)LuaScriptMgr.GetUnityObject(L, 1, typeof(GameObject)); GameObject root = NGUITools.GetRoot(go); LuaScriptMgr.Push(L, root); return(1); }
static int GetRoot(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); GameObject arg0 = (GameObject)LuaScriptMgr.GetUnityObject(L, 1, typeof(GameObject)); GameObject o = NGUITools.GetRoot(arg0); LuaScriptMgr.Push(L, o); return(1); }
void Start() { presenter = new HeaderMenuPresenter(this); presenter.ViewStart(); UIPanel panel = gameObject.GetComponent <UIPanel> (); panel.SetAnchor(NGUITools.GetRoot(gameObject)); presenter.OnShowLobbyRowTypeCallBack = OnLobbyShowTypeHandler; presenter.onHandleQuit = onGameplayQuitCallback; }
protected virtual GameObject CreateTemporary() { // Create temporary icon GameObject icon = (GameObject)Instantiate(this.iconSprite.gameObject); icon.layer = this.gameObject.layer; // Check if the icon has tweens on it TweenColor cTween = icon.GetComponent <TweenColor>(); if (cTween != null) { cTween.enabled = false; NGUITools.Destroy(cTween); } // Apply normal color to the clone icon UITexture tex = icon.GetComponent <UITexture>(); if (tex != null) { tex.color = Color.white; } // Re-parent the item if (UIDragDropRoot.root != null) { icon.transform.parent = UIDragDropRoot.root; } else { // Create temporary panel GameObject panelObj = new GameObject("_TemporaryPanel"); panelObj.layer = this.gameObject.layer; panelObj.transform.parent = NGUITools.GetRoot(this.gameObject).transform; panelObj.transform.localScale = Vector3.one; panelObj.transform.localRotation = Quaternion.identity; panelObj.transform.localPosition = Vector3.one; // Save the panel so we can destroy it this.mTemporaryDraggingPanel = panelObj; // Apply depth UIPanel panel = panelObj.AddComponent <UIPanel>(); panel.depth = UIPanel.nextUnusedDepth; icon.transform.parent = panelObj.transform; } // Fix it's position icon.transform.position = NGUITools.FindCameraForLayer(this.gameObject.layer).ScreenToWorldPoint(Input.mousePosition); icon.transform.rotation = this.transform.rotation; icon.transform.localScale = this.transform.localScale; return(icon); }
static public int GetRoot_s(IntPtr l) { try { UnityEngine.GameObject a1; checkType(l,1,out a1); var ret=NGUITools.GetRoot(a1); pushValue(l,true); pushValue(l,ret); return 2; } catch(Exception e) { return error(l,e); } }
void Start() { btnExits.GetComponent <UISprite>().SetAnchor(NGUITools.GetRoot(gameObject).transform); btnExits.GetComponent <UISprite>().topAnchor.absolute = 0; btnExits.GetComponent <UISprite>().leftAnchor.absolute = 0; btnExits.GetComponent <UISprite>().rightAnchor.absolute = 0; btnExits.GetComponent <UISprite>().bottomAnchor.absolute = 0; LobbyScene lobby = GameObject.Find("Lobby Scene").GetComponent <LobbyScene>(); valuesBetting = lobby.presenter.SelectedChannel.configuration.betting; for (int i = 0; i < valuesBetting.Length; i++) { double currentBetting = valuesBetting[i]; string value = Utility.Convert.ConvertShortcutMoney(currentBetting / 2) + "/" + Utility.Convert.ConvertShortcutMoney(currentBetting); SearchViewCheckbox item = SearchViewCheckbox.Create(value, i); item.name = "" + i; item.transform.parent = tableBetValue.transform; item.transform.localScale = Vector3.one; item.transform.localPosition = Vector3.zero; if (lobby.isFiltered()) { item.GetComponent <UIToggle>().value = false; } } tableBetValue.Reposition(); if (lobby.isFiltered()) { txtInput.value = lobby.TxtSearch(); if (lobby.options() != null) { foreach (int key in lobby.options().Keys) { if (key == TYPE_5_PEOPLE) { cbFivePeople.value = lobby.options()[key]; } if (key == TYPE_9_PEOPLE) { cbNinePeople.value = lobby.options()[key]; } } } foreach (double value in lobby.presenter.betValueSearch) { int index = Array.FindIndex <double>(valuesBetting, a => a == value); tableBetValue.GetChildList()[index].GetComponent <UIToggle>().value = true; } } }
static public int GetRoot_s(IntPtr l) { try { UnityEngine.GameObject a1; checkType(l, 1, out a1); var ret = NGUITools.GetRoot(a1); pushValue(l, ret); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
private void Start() { if (this.prefabs == null) { this.Done = true; return; } for (int i = 0; i < this.prefabs.Length; i++) { if (!(this.prefabs[i] == null)) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.prefabs[i]); gameObject.transform.SetParent(base.transform); gameObject.transform.localScale = ((this.scale.Length != 0) ? this.scale[i] : Vector3.one); gameObject.transform.localPosition = ((this.position.Length != 0) ? this.position[i] : Vector3.zero); gameObject.transform.localRotation = ((this.rotation.Length != 0) ? Quaternion.Euler(this.rotation[i]) : Quaternion.identity); if (this.renderQ > 0) { UIRoot component = NGUITools.GetRoot(base.gameObject).GetComponent <UIRoot>(); if (component) { ParticleSystem[] componentsInChildren = base.transform.GetComponentsInChildren <ParticleSystem>(true); for (int j = 0; j < componentsInChildren.Length; j++) { componentsInChildren[j].transform.localScale = component.transform.localScale * this.scaleFactor; } Renderer[] componentsInChildren2 = gameObject.GetComponentsInChildren <Renderer>(); for (int k = 0; k < componentsInChildren2.Length; k++) { if (this.changeToClipShader) { componentsInChildren2[k].material.shader = Shader.Find("Custom/Particle Texture Area Clip"); } componentsInChildren2[k].material.renderQueue = this.renderQ; if (base.gameObject.layer == LayerMask.NameToLayer("UI")) { componentsInChildren2[k].gameObject.layer = LayerMask.NameToLayer("UI"); } else { componentsInChildren2[k].gameObject.layer = LayerMask.NameToLayer("UIModel"); } } } } } } this.Done = true; }
static int GetRoot(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 1, typeof(UnityEngine.GameObject)); UnityEngine.GameObject o = NGUITools.GetRoot(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public static void Postfix(Panel_HUD __instance) { GameObject root = NGUITools.GetRoot(__instance.m_FullScreenMessageObject); int x = -150; CreateLabel(KeyCode.R, root, x); x += LABEL_SIZE; CreateLabel(KeyCode.L, root, x); x += LABEL_SIZE; CreateLabel(KeyCode.P, root, x); x += LABEL_SIZE; CreateLabel(KeyCode.LeftControl, root, x); x += LABEL_SIZE; CreateLabel(KeyCode.LeftShift, root, x); x += LABEL_SIZE; CreateWheelLabel(root, x); }
private static int GetRoot(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 1); GameObject go = (GameObject)ToLua.CheckUnityObject(L, 1, typeof(GameObject)); GameObject root = NGUITools.GetRoot(go); ToLua.Push(L, root); result = 1; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
private Vector4 CalcClipArea() { Vector4 finalClipRegion = this.m_targetPanel.finalClipRegion; Vector4 vector = new Vector4 { x = finalClipRegion.x - finalClipRegion.z / 2f, y = finalClipRegion.y - finalClipRegion.w / 2f, z = finalClipRegion.x + finalClipRegion.z / 2f, w = finalClipRegion.y + finalClipRegion.w / 2f }; UIRoot component = NGUITools.GetRoot(base.gameObject).GetComponent <UIRoot>(); Vector3 vector2 = this.m_targetPanel.transform.position - component.transform.position; float num = 2f; float num2 = num / (float)component.manualHeight; return(new Vector4 { x = vector2.x + vector.x * num2, y = vector2.y + vector.y * num2, z = vector2.x + vector.z * num2, w = vector2.y + vector.w * num2 }); }
protected virtual void OnEnable() { if (buttonTrue != null) { UIEventListener.Get(buttonTrue).onClick += OnClickButton; } if (buttonFalse != null) { UIEventListener.Get(buttonFalse).onClick += OnClickButton; } if (buttonNull != null) { UIEventListener.Get(buttonNull).onClick += OnClickButton; } if (bkgTransparent != null) { bkgTransparent.SetAnchor(NGUITools.GetRoot(gameObject).transform); bkgTransparent.topAnchor.absolute = 0; bkgTransparent.leftAnchor.absolute = 0; bkgTransparent.rightAnchor.absolute = 0; bkgTransparent.bottomAnchor.absolute = 0; } }
void Start() { UIPanel root = NGUITools.GetRoot(gameObject).GetComponent <UIPanel>(); backgroundTransparent.SetAnchor(root.gameObject, 0, 0, 0, 0); }
/// <summary> /// Creates a temporary icon. /// </summary> /// <returns>The temporary.</returns> protected virtual GameObject CreateTemporary() { // Create temporary icon GameObject icon = (GameObject)Instantiate(this.iconSprite.gameObject); icon.layer = this.gameObject.layer; // Check if the icon has tweens on it TweenColor cTween = icon.GetComponent <TweenColor>(); if (cTween != null) { cTween.enabled = false; NGUITools.Destroy(cTween); } // Apply normal color to the clone icon UITexture tex = icon.GetComponent <UITexture>(); if (tex != null) { tex.color = Color.white; } // Re-parent the item if (UIDragDropRoot.root != null) { icon.transform.parent = UIDragDropRoot.root; } else { // Create temporary panel GameObject panelObj = new GameObject("_TemporaryPanel"); panelObj.layer = this.gameObject.layer; panelObj.transform.parent = NGUITools.GetRoot(this.gameObject).transform; panelObj.transform.localScale = Vector3.one; panelObj.transform.localRotation = Quaternion.identity; panelObj.transform.localPosition = Vector3.one; // Save the panel so we can destroy it this.mTemporaryDraggingPanel = panelObj; // Apply depth UIPanel panel = panelObj.AddComponent <UIPanel>(); panel.depth = UIPanel.nextUnusedDepth; icon.transform.parent = panelObj.transform; } // Fix it's position icon.transform.position = NGUITools.FindCameraForLayer(this.gameObject.layer).ScreenToWorldPoint(Input.mousePosition); icon.transform.rotation = this.transform.rotation; icon.transform.localScale = this.transform.localScale; // Make sure the icon is at the center on the pointer UIWidget widget = icon.GetComponent <UIWidget>(); if (widget != null) { if (widget.pivot != UIWidget.Pivot.Center) { Vector3 centerOffset = Vector3.zero; switch (widget.pivot) { case UIWidget.Pivot.TopLeft: centerOffset = new Vector3(-widget.width / 2f, widget.height / 2f); break; case UIWidget.Pivot.Top: centerOffset = new Vector3(0f, widget.height / 2f); break; case UIWidget.Pivot.TopRight: centerOffset = new Vector3(widget.width / 2f, widget.height / 2f); break; case UIWidget.Pivot.Right: centerOffset = new Vector3(widget.width / 2f, 0f); break; case UIWidget.Pivot.BottomRight: centerOffset = new Vector3(widget.width / 2f, -widget.height / 2f); break; case UIWidget.Pivot.Bottom: centerOffset = new Vector3(0f, -widget.height / 2f); break; case UIWidget.Pivot.BottomLeft: centerOffset = new Vector3(-widget.width / 2f, -widget.height / 2f); break; case UIWidget.Pivot.Left: centerOffset = new Vector3(-widget.width / 2f, 0f); break; } icon.transform.localPosition += centerOffset; } } return(icon); }
/// <summary> /// 吹き出し画像スプライトの初期化 /// </summary> /// <returns></returns> private bool InitialazeCommentFrame() { // ラベルが無ければ処理しない if (!label) { return(MyUtil.ErrorLog("null値の変数です。")); } // スプライトピクセルサイズテーブル int fontSize = label.bitmapFont.defaultSize; Vector2 centerBoardDimensions = new Vector2(label.localSize.x, label.localSize.y); // 中央の矩形 Vector2 horizonBarDimensions = new Vector2(centerBoardDimensions.x, fontSize); // 横長の上下の矩形 Vector2 varticalBarDimensions = new Vector2(fontSize, centerBoardDimensions.y); // 縦長の左右の矩形 Vector2 cornerDimensions = new Vector2(fontSize, fontSize); // 四隅の矩形 Vector2[] dimensionsTable = { centerBoardDimensions, // 中央 horizonBarDimensions, // 上 horizonBarDimensions, // 下 varticalBarDimensions, // 右 varticalBarDimensions, // 左 cornerDimensions, // 右上 cornerDimensions, // 右下 cornerDimensions, // 左上 cornerDimensions, // 左下 }; // 座標テーブル // // 中央をピボットとする。 float units = 360.0f; Vector3[] positionTable = { label.transform.position, // 中央 label.transform.position + (new Vector3(0, horizonBarDimensions.y) + new Vector3(0, centerBoardDimensions.y)) / units / 2, // 上 label.transform.position + (new Vector3(0, -horizonBarDimensions.y) + new Vector3(0, -centerBoardDimensions.y)) / units / 2, // 下 label.transform.position + (new Vector3(varticalBarDimensions.x, 0) + new Vector3(centerBoardDimensions.x, 0)) / units / 2, // 右 label.transform.position + (new Vector3(-varticalBarDimensions.x, 0) + new Vector3(-centerBoardDimensions.x, 0)) / units / 2, // 左 label.transform.position + (new Vector3(cornerDimensions.x, cornerDimensions.y) + new Vector3(centerBoardDimensions.x, centerBoardDimensions.y)) / units / 2, // 右上 label.transform.position + (new Vector3(cornerDimensions.x, -cornerDimensions.y) + new Vector3(centerBoardDimensions.x, -centerBoardDimensions.y)) / units / 2, // 右下 label.transform.position + (new Vector3(-cornerDimensions.x, cornerDimensions.y) + new Vector3(-centerBoardDimensions.x, centerBoardDimensions.y)) / units / 2, // 左上 label.transform.position + (new Vector3(-cornerDimensions.x, -cornerDimensions.y) + new Vector3(-centerBoardDimensions.x, -centerBoardDimensions.y)) / units / 2, // 左下 }; // Enterキーのスプライトの座標を設定 enterKeySpritePosition = label.transform.position + (new Vector3(cornerDimensions.x, -cornerDimensions.y) + new Vector3(centerBoardDimensions.x, -centerBoardDimensions.y)) / 2 + new Vector3(-100, 0) - NGUITools.GetRoot(this.gameObject).transform.position; // スプライトの設定 for (int i = 0; i < sprites.Length; i++) { // スプライトが無ければ処理しない if (!sprites[i]) { return(MyUtil.ErrorLog("null値の変数です。")); } // スプライトサイズと座標を設定 sprites[i].width = (int)dimensionsTable[i].x; sprites[i].height = (int)dimensionsTable[i].y; sprites[i].transform.position = positionTable[i]; } // 発声者の名前のオブジェクトの座標を設定 if (speakerNameObj) { speakerNameObj.transform.localPosition = label.transform.position + (new Vector3(-cornerDimensions.x, cornerDimensions.y) + new Vector3(-centerBoardDimensions.x, centerBoardDimensions.y)) / 2 + new Vector3(20, 40) - NGUITools.GetRoot(this.gameObject).transform.position; } return(true); }
void Start() { root = NGUITools.GetRoot(gameObject).GetComponent <UIRoot>(); }