Inheritance: MonoBehaviour
コード例 #1
0
    void Awake()
    {
        m_transform = transform;
        gameObject.SetActive(false);
        ClimbTowerUILogicManager.Instance.Initialize(this);
        m_rewardList = m_transform.FindChild("RightBox/RewardList");
        m_towerList = m_transform.FindChild("TowerList");
        m_report = m_transform.FindChild("report").gameObject;
        m_reportList = m_transform.FindChild("report/BattleReportList");
        m_rewardTitle = m_transform.FindChild("report/img/lblTitle").GetComponentsInChildren<UILabel>(true)[0];
        m_highHistory = m_transform.FindChild("RightBox/historyHigh").GetComponentsInChildren<UILabel>(true)[0];
        //m_currentLevel = m_transform.FindChild("RightBox/TriPager/lblCurrentLevel").GetComponentsInChildren<UILabel>(true)[0];
        m_leftChallengeCount = m_transform.FindChild("LeftBox/lblContainer/lblChallengeCount").GetComponentsInChildren<UILabel>(true)[0];
        m_lblGuide = m_transform.FindChild("LeftBox/lblContainer/lblGuide").GetComponentsInChildren<UILabel>(true)[0];
        m_leftVIPSweepCount = m_transform.FindChild("LeftBox/lblContainer/lblVIPSweepCount").GetComponentsInChildren<UILabel>(true)[0];
        m_closeAnchor = m_transform.FindChild("closeAnchor").GetComponentsInChildren<UIAnchor>(true)[0];
        m_buttonVIP = m_transform.FindChild("RightBox/btnTowerVIP").GetComponentsInChildren<MogoTwoStatusButton>(true)[0];
        m_buttonNormal = m_transform.FindChild("RightBox/btnTowerNormal").GetComponentsInChildren<MogoTwoStatusButton>(true)[0];
        AddButtonListener("onClicked", "RightBox/btnEnter", ClimbTowerUILogicManager.Instance.OnEnterMap);
        AddButtonListener("onClicked", "LeftBox/btnTowerCharge", ClimbTowerUILogicManager.Instance.Charge);
        AddButtonListener("onClicked", "RightBox/btnTowerNormal", ClimbTowerUILogicManager.Instance.NormalSweep);
        AddButtonListener("onClicked", "RightBox/btnTowerVIP", ClimbTowerUILogicManager.Instance.VIPSweep);
        AddButtonListener("onClicked", "closeAnchor/btnClose", Close);
        AddButtonListener("onClicked", "report/img/btnClose", closeReport);
        if (MogoUIManager.Instance.WaitingWidgetName == "btnEnter")
        {
            TimerHeap.AddTimer(100, 0, () => { EventDispatcher.TriggerEvent("WaitingWidgetFinished"); });
        }

        //m_towerList.GetComponent<MogoListImproved>().SetGridLayout<TowerUnit>(7, m_towerList.transform, TowerLoaded);
    }
コード例 #2
0
ファイル: GuiBase.cs プロジェクト: dasjack/UnderworldExporter
    public void SetAnchorY(float offY)
    {
        UIAnchor uia = this.GetComponent <UIAnchor>();

        if (uia != null)
        {
            uia.relativeOffset = new Vector2(uia.relativeOffset.x, offY);
        }
    }
コード例 #3
0
ファイル: GuiBase.cs プロジェクト: dasjack/UnderworldExporter
    public void SetAnchorX(float offX)
    {
        UIAnchor uia = this.GetComponent <UIAnchor>();

        if (uia != null)
        {
            uia.relativeOffset = new Vector2(offX, uia.relativeOffset.y);
        }
    }
コード例 #4
0
ファイル: GuiBase.cs プロジェクト: dasjack/UnderworldExporter
    public void MoveControlOffset(float offX, float offY)
    {    //Moves a control by the specified distance on the gui
        UIAnchor uia = this.GetComponent <UIAnchor>();

        if (uia != null)
        {
            uia.relativeOffset = uia.relativeOffset + new Vector2(offX, offY);
        }
    }
コード例 #5
0
    protected override void DoAwake()
    {
        Transform rootAnchorTransform = transform.FindChild("Anchor");

        if (rootAnchorTransform)
        {
            rootAnchor = rootAnchorTransform.GetComponent <UIAnchor>();
        }
    }
コード例 #6
0
ファイル: UIMng.cs プロジェクト: atom-chen/tianyu
    /// <summary>
    /// 加载某个界面 by吴江
    /// </summary>
    /// <param name="_name"></param>
    /// <param name="_needOpen">加载以后是否需要打开</param>
    /// <returns></returns>
    public GUIBase GenGUI(string _name, bool _needOpen, SubGUIType _subType = SubGUIType.NONE, GUIType _baseOn = GUIType.NONE, System.Action <GUIBase> _callback = null)
    {
        if (uiDictionary.ContainsKey(_name) && uiDictionary[_name] != null)
        {
            if (_callback != null)
            {
                _callback(uiDictionary[_name]);
            }
            return(_needOpen ? uiDictionary[_name].OpenUI() : uiDictionary[_name].CloseUI());
        }
        Object obj = exResources.GetResource(ResourceType.GUI, _name);

        if (obj == null)
        {
            Debug.LogError("找不到名为:" + _name + "的UI预制");
            return(null);
        }
        GameObject gui = Instantiate(obj) as GameObject;

        gui.transform.parent        = uIRoot.transform;
        gui.transform.localScale    = Vector3.one;
        gui.transform.localPosition = Vector3.zero;
        gui.name = obj.name;
        obj      = null;
        UIAnchor anchor = gui.GetComponent <UIAnchor>();

        gui.SetActive(false);
        if (anchor != null)
        {
            anchor.uiCamera = GameCenter.cameraMng.uiCamera;
        }
        GUIBase guibase = gui.GetComponent <GUIBase>();

        if (guibase != null)
        {
            uiDictionary[_name] = guibase;
            if (_subType != SubGUIType.NONE)
            {
                guibase.InitSubGUIType = _subType;
            }
            if (_needOpen)
            {
                guibase.OpenUI(_baseOn);
            }
            if (_callback != null)
            {
                _callback(guibase);
            }
            return(guibase);
        }
        else
        {
            Debug.LogError("在" + _name + " UI预制上找不到 GUIBase 组件!");
        }
        return(null);
    }
コード例 #7
0
        public static UIGenericValueWatcher Get(UIAnchor anchor, float timer, Func <string> del)
        {
            var valueWatcher = ItemPool.SpawnUIPrefab <UIGenericValueWatcher>(UnityDirs.UI + "UIGenericValueWatcher", anchor.Get().transform);

            valueWatcher._timer.StartNewTime(timer);
            valueWatcher._checkTimer = timer > 0;
            valueWatcher._updateDel  = del;
            anchor.SetAnchorPosition(valueWatcher._rectTr);
            return(valueWatcher);
        }
コード例 #8
0
ファイル: sdAnchor.cs プロジェクト: tsinglee2009/Dczg
    void Start()
    {
        float    fRadio = (standard_width / standard_height) / ((float)Screen.width / (float)Screen.height);
        UIAnchor anchor = gameObject.GetComponent <UIAnchor>();

        if (anchor != null)
        {
            anchor.relativeOffset.y = anchor.relativeOffset.y / fRadio;
        }
    }
コード例 #9
0
ファイル: PageMap.cs プロジェクト: sam-watson/Fiasco-app
    public virtual GameObject AddContent(UIAnchor anchor, GameObject prefab)
    {
        var content = NGUITools.AddChild(anchor.gameObject, prefab);

        if (anchor == GetAnchor(anchor.side))
        {
            CorrectOffsets(anchor);
        }
        return(content);
    }
コード例 #10
0
ファイル: Window.cs プロジェクト: request-time-out/A-Scripts
 public void AddContentText(
     GameObject prefab,
     UIPivot pivot,
     UIAnchor anchor,
     Vector2 offset,
     string text)
 {
     this.AddContentText(prefab, pivot, anchor, offset);
     this.SetContentText(text, this._contentText.Count - 1);
 }
コード例 #11
0
 public virtual void Start()
 {
     anchor         = this.GetComponent <UIAnchor>();
     stretch        = this.GetComponent <UIStretch>();
     CursorPosition = new Rect(
         0.0f,
         0.0f,
         cursorSizeX,
         cursorSizeY);
 }
コード例 #12
0
 public override void Init()
 {
     base.Init();
     this.PanelTransform = this.transform.Find("AnchorLeft/BuffPanel");
     this.BuffNode       = this.transform.Find("AnchorLeft/BuffPanel/Buff");
     this.PassiveNode    = this.transform.Find("AnchorRight/BuffPanel/Passive");
     this.tAlpha         = this.transform.GetComponent <TweenAlpha>();
     this.Anchor         = this.transform.FindChild("AnchorLeft").GetComponent <UIAnchor>();
     this.m_BuffItem     = ResourceManager.LoadPath <GameObject>("Prefab/UI/Skill/BuffItem", null, 0);
 }
コード例 #13
0
    // 時間の表示
    void TimeUI()
    {
        Text               = timeLabel.GetComponent("UILabel") as UILabel;
        Text.pivot         = UIWidget.Pivot.Left;
        Offset             = timeLabel.GetComponent("UIAnchor") as UIAnchor;
        Offset.side        = UIAnchor.Side.Top;
        Offset.pixelOffset = new Vector2(-50, -40);

        Text.text = "Time : " + (int)Rule.GameTime;
    }
コード例 #14
0
ファイル: RhythmNote.cs プロジェクト: jcabe4/Reignite
    public void Init(UIAnchor pos, Note.NoteColor newColor, float width, GameObject gameObj)
    {
        Start();

        color = newColor;
        anchor.relativeOffset.x = pos.relativeOffset.x;
        anchor.relativeOffset.y = pos.relativeOffset.y;

        SetColor();
        SetWidth(width);
    }
コード例 #15
0
    UIAnchor CreatSpriteAndParentToNGUIPanel(string carName)
    {
        GameObject g = (GameObject.Instantiate(nameLabelPrefab) as GameObject);

        g.transform.parent     = GameObject.Find(uiRootName).transform;
        g.transform.localScale = Vector3.one;
        g.GetComponentInChildren <UILabel>().text = carName;
        UIAnchor anchor = g.GetComponentInChildren <UIAnchor>();

        return(anchor);
    }
コード例 #16
0
    // スコアの表示
    void ScoreUI()
    {
        Text               = scoreLabel.GetComponent("UILabel") as UILabel;
        Text.pivot         = UIWidget.Pivot.Left;
        Offset             = scoreLabel.GetComponent("UIAnchor") as UIAnchor;
        Offset.side        = UIAnchor.Side.TopLeft;
        Offset.pixelOffset = new Vector2(10, -40);
        int score = Rule.GetScore();

        Text.text = string.Format("Score : {0:D4}", score);
    }
コード例 #17
0
    void ClearUI()
    {
        var clearLabel = NGUITools.AddChild(Parent, labelPrefab);

        clearLabel.transform.localScale = new Vector2(60f, 60f);
        Text        = clearLabel.GetComponent("UILabel") as UILabel;
        Text.pivot  = UIWidget.Pivot.Center;
        Offset      = timeLabel.GetComponent("UIAnchor") as UIAnchor;
        Offset.side = UIAnchor.Side.Top;
        Text.text   = "Clear!!";
    }
コード例 #18
0
        internal static void AnchorToScreen(UIAnchor anchor, int x, int y, out int out_x, out int out_y)
        {
            int sw = Screen.width;
            int sh = Screen.height - 35;

            switch (anchor)
            {
            // Upper
            case UIAnchor.UpperLeft:
                y = sh - y;
                goto default;

            case UIAnchor.UpperCenter:
                x = (sw / 2) + x;
                y = sh - y;
                goto default;

            case UIAnchor.UpperRight:
                x = sw - x;
                y = sh - y;
                goto default;

            // Middle
            case UIAnchor.MiddleLeft:
                y = (sh / 2) - y;
                goto default;

            case UIAnchor.MiddleCenter:
                x = (sw / 2) + x;
                y = (sh / 2) - y;
                goto default;

            case UIAnchor.MiddleRight:
                x = sw - x;
                y = (sh / 2) - y;
                goto default;

            // Lower
            case UIAnchor.LowerCenter:
                x = (sw / 2) + x;
                goto default;

            case UIAnchor.LowerRight:
                x = sw - x;
                goto default;

            // End
            case UIAnchor.LowerLeft:
            default:
                out_x = x;
                out_y = y;
                break;
            }
        }
コード例 #19
0
ファイル: UIManager.cs プロジェクト: atom-chen/shisanshui-1
    private UIWin getUI(WinID ID)
    {
        UIWin UI = null;

        try
        {
            if (ID == WinID.Max)
            {
                return(null);
            }
            UI = UIInstances[(int)ID];
            if (UI == null)
            {
                //there is none can use, then add a new one
                UnityEngine.Object prefab = Resources.Load(string.Format("UI/{0}", ID));
                if (prefab == null)
                {
                    Debug.LogWarning(string.Format("UI/{0} is not exist!", ID));
                    return(null);
                }
                else
                {
                    GameObject go = (GameObject)Instantiate(prefab);
                    go.name = prefab.name;
                    UI      = go.GetComponent <UIWin>();
                    if (!UI)
                    {
                        Debug.LogError(string.Format("UI:{0} has not UIWin component!", ID));
                        return(null);
                    }
                    Transform trans = go.transform;
                    trans.parent         = transform;
                    trans.localScale     = Vector3.one;
                    trans.localPosition  = new Vector3(0, 0, (float)UI.eLayer);
                    UIInstances[(int)ID] = UI;
                    UI.ID = ID;
                    //init anchor
                    UIAnchor anchor = UI.GetComponent <UIAnchor>();
                    if (anchor)
                    {
                        anchor.runOnlyOnce = true;
                        anchor.uiCamera    = UICamera.currentCamera;
                    }
                    go.SetActive(false);
                }
            }
            return(UI);
        }
        catch (System.Exception ex)
        {
            Debug.LogException(ex);
            return(null);
        }
    }
コード例 #20
0
    static private bool SetAnchorCameraCallback(Transform tr, object args)
    {
        Camera   cam    = args as Camera;
        UIAnchor anchor = tr.GetComponent <UIAnchor> ();

        if (anchor != null)
        {
            anchor.uiCamera = cam;
        }
        return(false);
    }
コード例 #21
0
 static public int get_container(IntPtr l)
 {
     try {
         UIAnchor self = (UIAnchor)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.container);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #22
0
 static public int get_pixelOffset(IntPtr l)
 {
     try {
         UIAnchor self = (UIAnchor)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.pixelOffset);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #23
0
ファイル: UXAnchor.cs プロジェクト: Hengle/swc-decompiled
        protected void Init(GameObject root, UIAnchor.Side side)
        {
            this.root = root;
            if (root.GetComponent <UIAnchor>() != null)
            {
                throw new Exception("UXAnchor must not have a UIAnchor added already");
            }
            UIAnchor uIAnchor = root.AddComponent <UIAnchor>();

            uIAnchor.side = side;
            this.uxCamera.AddNewAnchor(root);
        }
コード例 #24
0
    protected override void Start()
    {
        if (map == null)
        {
            return;
        }

        mAnchor = GetComponent <UIAnchor>();

        base.Start();
        UpdateAlignment();
    }
コード例 #25
0
 public override UILabel AddLabel(UIAnchor anchor, GameObject prefab)
 {
     if (anchor == head)
     {
         var label = anchor.GetComponentInChildren <UILabel>();
         if (label != null)
         {
             return(label);
         }
     }
     return(base.AddLabel(anchor, prefab));
 }
コード例 #26
0
    public void Fill(Component com, MyJson.IJsonNode json)
    {
        UIAnchor t     = com as UIAnchor;
        var      jsono = json as MyJson.JsonNode_Object;

        t.uiCamera       = GameObjParser.IDToComponent <Camera>(jsono["uiCamera"] as MyJson.JsonNode_ValueNumber);
        t.container      = GameObjParser.IDToObj(jsono["container"] as MyJson.JsonNode_ValueNumber);
        t.side           = (UIAnchor.Side)Enum.Parse(typeof(UIAnchor.Side), jsono["side"] as MyJson.JsonNode_ValueString);
        t.runOnlyOnce    = jsono["runOnlyOnce"] as MyJson.JsonNode_ValueNumber;
        t.relativeOffset = ComponentTypeConvert.StringToVector2(jsono["relativeOffset"] as MyJson.JsonNode_ValueString);
        t.pixelOffset    = ComponentTypeConvert.StringToVector2(jsono["pixelOffset"] as MyJson.JsonNode_ValueString);
    }
コード例 #27
0
 static public int get_side(IntPtr l)
 {
     try {
         UIAnchor self = (UIAnchor)checkSelf(l);
         pushValue(l, true);
         pushEnum(l, (int)self.side);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #28
0
 // Use this for initialization
 void Start()
 {
     MainGame.topLayerCamera = this;
     if (root == null)
     {
         UIAnchor myAnchor = GetComponentInChildren <UIAnchor>();
         if (myAnchor != null)
         {
             root = myAnchor.transform;
         }
     }
 }
コード例 #29
0
 void Awake()
 {
     if (NGUI2DRootPanel.IsHHDScreen)
     {
         UIAnchor anchor = GetComponent <UIAnchor>();
         if (null != anchor)
         {
             anchor.pixelOffset = new Vector2(-200f, -300f);
             anchor.enabled     = true;
         }
     }
 }
コード例 #30
0
 static public int get_runOnlyOnce(IntPtr l)
 {
     try {
         UIAnchor self = (UIAnchor)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.runOnlyOnce);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #31
0
        public static void TT()
        {
            if (((Mod_OnGUI_Player)GameState.s_playerCharacter).showGameObjectBrowser == false)
            {
                if (((Mod_OnGUI_Player)GameState.s_playerCharacter).inspecting == null)
                {
                    ((Mod_OnGUI_Player)GameState.s_playerCharacter).inspecting = UICustomizer.UiCamera.transform;
                }

                if (GameBrowserBackground == null)
                {
                    UIMultiSpriteImageButton portraitLast = null;

                    foreach (UIMultiSpriteImageButton btn in UnityEngine.Object.FindObjectsOfType <UIMultiSpriteImageButton>())
                    {
                        if (btn.ToString() == "PartyPortrait(Clone) (UIMultiSpriteImageButton)" && portraitLast == null)
                        {
                            portraitLast = btn;
                        }
                    }

                    GameBrowserBackground             = NGUITools.AddWidget <UITexture>(portraitLast.transform.parent.parent.gameObject);
                    GameBrowserBackground.mainTexture = new Texture2D(500, 500);

                    GameBrowserBackground.transform.localScale = new Vector3(1100f, 600f, 1f);                     // those values are for 1920*1080...
                    //GameBrowserBackground.transform.localScale = new Vector3 (1600f, 800f, 1f); // those values are for 1280*1024

                    // rescaler
                    if (Screen.width != 1920)
                    {
                        float addwidth  = (1920 - Screen.width) * 0.78f;
                        float addheight = (1080 - Screen.height) * 0.55f;
                        GameBrowserBackground.transform.localScale += new Vector3(addwidth, addheight, 0f);
                    }

                    BoxCollider boxColl = NGUITools.AddWidgetCollider(GameBrowserBackground.gameObject); // adding a box collider, it's required for the UINoClick component
                    boxColl.gameObject.AddComponent <UINoClick>();                                       // this prevents clicks from going through the U-frame
                    UIAnchor ank = GameBrowserBackground.gameObject.AddComponent <UIAnchor>();
                    ank.side = UIAnchor.Side.Center;
                }
                else
                {
                    GameBrowserBackground.gameObject.SetActive(true);
                }

                ((Mod_OnGUI_Player)GameState.s_playerCharacter).showGameObjectBrowser = true;                 // temporarily turned off
            }
            else
            {
                GameBrowserBackground.gameObject.SetActive(false);
                ((Mod_OnGUI_Player)GameState.s_playerCharacter).showGameObjectBrowser = false;
            }
        }
コード例 #32
0
        /// <summary>
        /// 设置 UI 组件锚点
        /// </summary>
        /// <param name="rectTransform">UI 组件</param>
        /// <param name="x">X 轴锚点</param>
        /// <param name="y">Y 轴锚点</param>
        public static void SetUIAnchor(RectTransform rectTransform, UIAnchor x, UIAnchor y)
        {
            float x1 = 0.5f, x2 = 0.5f, y1 = 0.5f, y2 = 0.5f;

            switch (x)
            {
            case UIAnchor.Left:
                x1 = 0;
                x2 = 0;
                break;

            case UIAnchor.Center:
                x1 = 0.5f;
                x2 = 0.5f;
                break;

            case UIAnchor.Right:
                x1 = 1;
                x2 = 1;
                break;

            case UIAnchor.Stretch:
                x1 = 0;
                x2 = 1;
                break;
            }
            switch (y)
            {
            case UIAnchor.Top:
                y1 = 1;
                y2 = 1;
                break;

            case UIAnchor.Center:
                y1 = 0.5f;
                y2 = 0.5f;
                break;

            case UIAnchor.Bottom:
                y1 = 0;
                y2 = 0;
                break;

            case UIAnchor.Stretch:
                y1 = 0;
                y2 = 1;
                break;
            }

            rectTransform.anchorMin = new Vector2(x1, y1);
            rectTransform.anchorMax = new Vector2(x2, y2);
        }
コード例 #33
0
	void Start () 
	{
		if(maxOffset <=0)
			maxOffset = 80;
		joyAnchor = joyStick.GetComponent<UIAnchor>();
		screenSize =new Vector2(Screen.width, Screen.height);
		originalOffset = joyAnchor.relativeOffset;
		
		if(hasDynamic)
			joyStick.SetActiveRecursively(false);
		else
		{
			joyStick.SetActiveRecursively(true);
			
			joyCenter = new Vector2(joyAnchor.relativeOffset.x * Screen.width, joyAnchor.relativeOffset.y * Screen.height);
		}

	}
コード例 #34
0
ファイル: Window.cs プロジェクト: nkornek/RocketShips
        private GameObject CreateButton(GameObject prefab, string name, UIAnchor anchor, UIPivot pivot, Vector2 offset, out ButtonInfo buttonInfo) {
            buttonInfo = null;
            if(prefab == null) return null;
            
            GameObject instance = UITools.InstantiateGUIObject<ButtonInfo>(
                prefab,
                content.transform,
                name,
                pivot,
                anchor.min,
                anchor.max,
                offset
            );
            if(instance == null) return null;

            buttonInfo = instance.GetComponent<ButtonInfo>();
            Button button = instance.GetComponent<Button>();
            if(button == null) {
                Debug.Log("Button prefab is missing Button component!");
                return null;
            }
            if(buttonInfo == null) {
                Debug.Log("Button prefab is missing ButtonInfo component!");
                return null;
            }
            return instance;
        }
コード例 #35
0
ファイル: HUDIndicator.cs プロジェクト: HexHash/LegacyRust
 private Target(string name, bool automatic, int manualSize, UIAnchor.Side side)
 {
     this.automatic = automatic;
     this.manualSize = manualSize;
     this.name = name;
     this.side = side;
     this._root = null;
     this._anchor = null;
 }
コード例 #36
0
ファイル: UIMiniMap.cs プロジェクト: floatyears/Decrypt
 public override void UpdateAlignment()
 {
     base.UpdateAlignment();
     if (this.mAnchor == null)
     {
         this.mAnchor = base.GetComponent<UIAnchor>();
     }
     if (this.mAnchor != null)
     {
         this.mAnchor.side = (UIAnchor.Side)this.pivot;
     }
     if (base.iconRoot != null)
     {
         base.iconRoot.localPosition = new Vector3(this.rendererTransform.localPosition.x, this.rendererTransform.localPosition.y, 1f);
     }
     if (this.overlay != null && NJGMap.instance.atlas != null)
     {
         UISpriteData sprite = NJGMap.instance.atlas.GetSprite(this.overlay.spriteName);
         if (sprite != null)
         {
             Vector4 border = this.overlay.border;
             this.overlay.width = (int)this.mapScale.x + (int)(border.x + border.z + (float)this.overlayBorderOffset);
             this.overlay.height = (int)this.mapScale.y + (int)(border.y + border.w + (float)this.overlayBorderOffset);
         }
     }
 }
コード例 #37
0
ファイル: UIAnchor.cs プロジェクト: HexHash/LegacyRust
 public static Vector3 WorldOrigin(Camera camera, UIAnchor.Side side, RectOffset offset, bool halfPixel)
 {
     Vector3 vector3 = new Vector3();
     UIAnchor.Flags flag;
     vector3.z = 0f;
     Rect rect = offset.Add(camera.pixelRect);
     float single = rect.xMin;
     float single1 = rect.xMax;
     float single2 = rect.yMin;
     float single3 = rect.yMax;
     UIAnchor.Side side1 = side;
     float single4 = single;
     float single5 = single1;
     float single6 = single2;
     float single7 = single3;
     if (camera.isOrthoGraphic)
     {
         flag = (!halfPixel ? UIAnchor.Flags.CameraIsOrthographic : UIAnchor.Flags.CameraIsOrthographic | UIAnchor.Flags.HalfPixelOffset);
     }
     else if (!halfPixel)
     {
         flag = (UIAnchor.Flags)0;
     }
     else
     {
         flag = UIAnchor.Flags.HalfPixelOffset;
     }
     UIAnchor.ScreenOrigin(side1, single4, single5, single6, single7, flag, out vector3.x, out vector3.y);
     return camera.ScreenToWorldPoint(vector3);
 }
コード例 #38
0
ファイル: UIAnchor.cs プロジェクト: HexHash/LegacyRust
 public static void ScreenOrigin(UIAnchor.Side side, float xMin, float xMax, float yMin, float yMax, float relativeOffsetX, float relativeOffsetY, out float x, out float y)
 {
     float single;
     float single1;
     UIAnchor.ScreenOrigin(side, xMin, xMax, yMin, yMax, out single, out single1);
     x = single + relativeOffsetX * (xMax - xMin);
     y = single1 + relativeOffsetY * (yMax - yMin);
 }
コード例 #39
0
ファイル: UITools.cs プロジェクト: hjrhjr/Beats2
 /// <summary>
 /// Adds an anchor to an object and set it's initial local position
 /// </summary>
 public static UIAnchor AddAnchor(GameObject gameObj, UIAnchor.Side side)
 {
     UIAnchor anchor = gameObj.AddComponent<UIAnchor>();
     anchor.side = side;
     return anchor;
 }
コード例 #40
0
ファイル: Window.cs プロジェクト: nkornek/RocketShips
 public void AddContentText(GameObject prefab, UIPivot pivot, UIAnchor anchor, Vector2 offset, string text) {
     AddContentText(prefab, pivot, anchor, offset);
     SetContentText(text, _contentText.Count - 1);
 }
コード例 #41
0
ファイル: Window.cs プロジェクト: nkornek/RocketShips
 public void AddContentText(GameObject prefab, UIPivot pivot, UIAnchor anchor, Vector2 offset) {
     Text text = null;
     CreateText(prefab, ref text, "Content Text", pivot, anchor, offset);
     _contentText.Add(text);
 }
コード例 #42
0
    protected override void AwakeImpl()
    {
        base.AwakeImpl();

        m_ViewSpriteTr = transform.FindChild("ListBaseSprite");
        m_ViewScale = m_ViewSpriteTr.localScale;
        m_TopLeft = transform.FindChild("ListBaseSprite/TopLeft");
        m_BottomRight = transform.FindChild("ListBaseSprite/BottomRight");
        //m_DragCamera = transform.FindChild("ListBaseSprite").GetComponent<UIDragCamera>();
        NvGameUIManager mgr = Singlton.getInstance("NvGameUIManager") as NvGameUIManager;
        m_UICamera = mgr.GameUICamera;

        m_ListPrefab = Resources.Load("UI Prefabs/Prefabs/Controls/UIListView") as GameObject;
        m_ListView = GameObject.Instantiate( m_ListPrefab ) as GameObject;
        //rename list view
        m_ListView.name = listName;
        Transform listviewCamera = m_ListView.transform.FindChild("UIListViewCamera");
        //Transform listviewCamera = m_ListView.transform.FindChild("UIListViewCamera" );
        //m_ListViewCamera = listviewCamera.GetComponent<UIDraggableCamera>();
        //rename list view draggable camera
        //m_ListViewCamera.name = listName + "Camera";
        //set draggable camera to drag camera
        //m_DragCamera.draggableCamera = m_ListViewCamera;
        m_ListViewViewport = listviewCamera.GetComponent<UIViewport>();
        //set viewport camera
        m_ListViewViewport.sourceCamera = m_UICamera;
        m_ListViewLink = m_ListView.transform.FindChild("Link");
        m_ListViewLink.localScale = Utility.GetScreenRatio();
        Transform listOffset = m_ListView.transform.FindChild("Link/Anchor/ListOffset");
        listOffset.transform.localPosition = new Vector3 ( dragCameraDistance, dragCameraDistance, listOffset.transform.localPosition.z );
        m_ListViewTable = listOffset.GetComponent<UITable>();
        m_listViewAnchor = m_ListView.transform.FindChild("Link/Anchor").GetComponent<UIAnchor>();
        //m_DragPanel = m_ListView.transform.FindChild("Link/Anchor/ListOffset").GetComponent<UIDraggablePanel>();
        //set ui layer camera to list view anchor
        m_listViewAnchor.uiCamera = m_UICamera;
        //set slider bar
        if ( horizontalScrollBar != null )
        {
            m_horizontalScrollBar = horizontalScrollBar.GetComponent<UIScrollBar>();
            //m_DragPanel.scale = new Vector3( 1.0f, 0.0f, 0.0f );
            //m_DragPanel.horizontalScrollBar = m_horizontalScrollBar;
        }
        if ( verticalScrollBar != null )
        {
            m_verticalScrollBar = verticalScrollBar.GetComponent<UIScrollBar>();
            //m_DragPanel.scale = new Vector3( 0.0f, 1.0f, 0.0f );
            //m_DragPanel.verticalScrollBar = m_verticalScrollBar;
        }
    }
コード例 #43
0
 /// <summary>
 /// Find all needed components.
 /// </summary>
 void Awake()
 {
     mAnchor = GetComponent<UIAnchor>();
 }
コード例 #44
0
ファイル: HUDIndicator.cs プロジェクト: HexHash/LegacyRust
 public Target(string name, UIAnchor.Side side)
     : this(name, true, 1000, side)
 {
 }
コード例 #45
0
ファイル: RhythmGame.cs プロジェクト: jcabe4/Reignite
    private void CreateNotes()
    {
        if (noteIndex < notes.Count)
        {
            if (notes[noteIndex].startTotal < timeLapsed + timeOffset)
            {
                pos = spawnPositions[notes[noteIndex].pitchPosition];
                color = notes[noteIndex].color;
                noteWidth = notes[noteIndex].noteDuration * lengthRatio;

                switch(notes[noteIndex].color)
                {
                    case Note.NoteColor.Blue:
                    case Note.NoteColor.Yellow:
                    case Note.NoteColor.Green:
                    case Note.NoteColor.Red:
                    {
                        GameObject newNote = (GameObject)Instantiate(singlePrefab);
                        newNote.transform.parent = noteParent.transform;
                        newNote.transform.localScale = Vector3.one;
                        newNote.name = notesSpawned.ToString() + ": Note (" + notes[noteIndex].color.ToString() + ")";

                        rNote = newNote.GetComponent<RhythmNote>();
                        rNote.Init(pos, color, noteWidth, gameObject);
                        notesSpawned++;
                        break;
                    }
                    default:
                    {
                        GameObject newNote = (GameObject)Instantiate(doublePrefab);
                        newNote.transform.parent = noteParent.transform;
                        newNote.transform.localScale = Vector3.one;
                        newNote.name = notesSpawned.ToString() + ": Note (" + notes[noteIndex].color.ToString() + ")";

                        rNote = newNote.GetComponent<RhythmNote>();
                        rNote.Init(pos, color, noteWidth, gameObject);
                        notesSpawned++;
                        break;
                    }
                }

                noteIndex++;
            }
        }
    }
コード例 #46
0
ファイル: Window.cs プロジェクト: nkornek/RocketShips
 public void AddContentImage(GameObject prefab, UIPivot pivot, UIAnchor anchor, Vector2 offset) {
     CreateImage(prefab, "Image", pivot, anchor, offset);
 }
コード例 #47
0
ファイル: RhythmNote.cs プロジェクト: jcabe4/Reignite
    void Start()
    {
        if (!anchor)
        {
            anchor = gameObject.GetComponent<UIAnchor>();
        }

        if (bar1 && !barStretch1)
        {
            barStretch1 = bar1.gameObject.GetComponent<UIStretch>();
        }

        if (bar2 && !barStretch2)
        {
            barStretch2 = bar2.gameObject.GetComponent<UIStretch>();
        }
    }
コード例 #48
0
ファイル: Window.cs プロジェクト: nkornek/RocketShips
 public void AddContentImage(GameObject prefab, UIPivot pivot, UIAnchor anchor, Vector2 offset, string text) {
     AddContentImage(prefab, pivot, anchor, offset);
 }
コード例 #49
0
ファイル: RhythmInput.cs プロジェクト: jcabe4/Reignite
 void Start()
 {
     cursorPos = cursor.GetComponent<UIAnchor> ();
     keys = System.Enum.GetNames(typeof(KeyCode)).Length;
 }
コード例 #50
0
ファイル: Window.cs プロジェクト: nkornek/RocketShips
        public void CreateButton(GameObject prefab, UIPivot pivot, UIAnchor anchor, Vector2 offset, string buttonText, UnityAction confirmCallback, UnityAction cancelCallback, bool setDefault) {
            if(prefab == null) return;
            ButtonInfo buttonInfo;
            GameObject instance = CreateButton(prefab, "Button", anchor, pivot, offset, out buttonInfo);
            if(instance == null) return;
            Button button = instance.GetComponent<Button>();
            if(confirmCallback != null) button.onClick.AddListener(confirmCallback);

            // Create a UI cancel event for this button
            CustomButton customButton = button as CustomButton;
            if(cancelCallback != null && customButton != null) customButton.CancelEvent += cancelCallback;

            if(buttonInfo.text != null) buttonInfo.text.text = buttonText;
            if(setDefault) _defaultUIElement = instance;
        }
コード例 #51
0
ファイル: UIAnchor.cs プロジェクト: HexHash/LegacyRust
 public static void ScreenOrigin(UIAnchor.Side side, float xMin, float xMax, float yMin, float yMax, UIAnchor.Flags flags, out float x, out float y)
 {
     float single;
     float single1;
     float single2;
     float single3;
     switch ((byte)(flags & (!UIAnchor.Info.isWindows ? UIAnchor.Flags.CameraIsOrthographic : UIAnchor.Flags.CameraIsOrthographic | UIAnchor.Flags.HalfPixelOffset)))
     {
         case 1:
         {
             UIAnchor.ScreenOrigin(side, xMin, xMax, yMin, yMax, out single, out single1);
             x = Mathf.Round(single);
             y = Mathf.Round(single1);
             break;
         }
         case 2:
         {
             UIAnchor.ScreenOrigin(side, xMin, xMax, yMin, yMax, out x, out y);
             break;
         }
         case 3:
         {
             UIAnchor.ScreenOrigin(side, xMin, xMax, yMin, yMax, out single2, out single3);
             x = Mathf.Round(single2) - 0.5f;
             y = Mathf.Round(single3) + 0.5f;
             break;
         }
         default:
         {
             goto case 2;
         }
     }
 }
コード例 #52
0
ファイル: Window.cs プロジェクト: nkornek/RocketShips
        // Private Methods

        private void CreateText(GameObject prefab, ref Text textComponent, string name, UIPivot pivot, UIAnchor anchor, Vector2 offset) {
            if(prefab == null || content == null) return;
            if(textComponent != null) {
                Debug.LogError("Window already has " + name + "!");
                return;
            }

            GameObject instance = UITools.InstantiateGUIObject<Text>(
                prefab,
                content.transform,
                name,
                pivot,
                anchor.min,
                anchor.max,
                offset
            );
            if(instance == null) return;
            textComponent = instance.GetComponent<Text>();
        }
コード例 #53
0
ファイル: UIAnchor.cs プロジェクト: HexHash/LegacyRust
 public static void ScreenOrigin(UIAnchor.Side side, float xMin, float xMax, float yMin, float yMax, out float x, out float y)
 {
     switch (side)
     {
         case UIAnchor.Side.BottomLeft:
         {
             x = xMin;
             y = yMin;
             break;
         }
         case UIAnchor.Side.Left:
         {
             x = xMin;
             y = (yMin + yMax) / 2f;
             break;
         }
         case UIAnchor.Side.TopLeft:
         {
             x = xMin;
             y = yMax;
             break;
         }
         case UIAnchor.Side.Top:
         {
             x = (xMin + xMax) / 2f;
             y = yMax;
             break;
         }
         case UIAnchor.Side.TopRight:
         {
             x = xMax;
             y = yMax;
             break;
         }
         case UIAnchor.Side.Right:
         {
             x = xMax;
             y = (yMin + yMax) / 2f;
             break;
         }
         case UIAnchor.Side.BottomRight:
         {
             x = xMax;
             y = yMin;
             break;
         }
         case UIAnchor.Side.Bottom:
         {
             x = (xMin + xMax) / 2f;
             y = yMin;
             break;
         }
         case UIAnchor.Side.Center:
         {
             x = (xMin + xMax) / 2f;
             y = (yMin + yMax) / 2f;
             break;
         }
         default:
         {
             throw new ArgumentOutOfRangeException();
         }
     }
 }
コード例 #54
0
ファイル: Window.cs プロジェクト: nkornek/RocketShips
        private void CreateImage(GameObject prefab, string name, UIPivot pivot, UIAnchor anchor, Vector2 offset) {
            if(prefab == null || content == null) return;

            UITools.InstantiateGUIObject<Image>(
                prefab,
                content.transform,
                name,
                pivot,
                anchor.min,
                anchor.max,
                offset
            );
        }
コード例 #55
0
ファイル: UIMiniMap.cs プロジェクト: floatyears/Decrypt
 protected override void Start()
 {
     if (this.map == null)
     {
         return;
     }
     this.mAnchor = base.GetComponent<UIAnchor>();
     base.Start();
     this.UpdateAlignment();
 }
コード例 #56
0
ファイル: HUDIndicator.cs プロジェクト: HexHash/LegacyRust
 public Target(string name, int manualSize, UIAnchor.Side side)
     : this(name, false, manualSize, side)
 {
 }