コード例 #1
0
    public static void Tooltip_Rect(Form cForm, Vector3 showPosition)
    {
        if (TsPlatform.IsMobile)
        {
            float x = (GUICamera.width - cForm.GetSizeX() * 2f) / 2f;
            cForm.SetLocation(x, 10f);
        }
        else if (!TsPlatform.IsMobile || (showPosition == Vector3.zero && ItemTooltipDlg_Second.MOBILE_TOOLTIP_POS == Vector3.zero))
        {
            float   num    = 20f;
            Vector3 vector = GUICamera.ScreenToGUIPoint(NkInputManager.mousePosition);
            Vector2 size   = cForm.GetSize();
            if (NrTSingleton <FormsManager> .Instance.IsShow(G_ID.ITEMTOOLTIP_SECOND_DLG))
            {
                float x2 = (GUICamera.width - cForm.GetSizeX() * 2f) / 2f;
                cForm.SetLocation(x2, 10f);
            }
            else
            {
                float num2 = vector.x + num;
                if (num2 + size.x > GUICamera.width)
                {
                    num2 = vector.x - num - size.x;
                }
                float num3 = GUICamera.height - vector.y;
                if (num3 + size.y > GUICamera.height)
                {
                    float num4 = num3 + size.y - GUICamera.height;
                    num3 -= num4;
                }
                cForm.SetLocation(num2, num3);
            }
        }
        else
        {
            if (showPosition != Vector3.zero && ItemTooltipDlg_Second.MOBILE_TOOLTIP_POS == Vector3.zero)
            {
                showPosition.y = -showPosition.y;
                ItemTooltipDlg_Second.MOBILE_TOOLTIP_POS = showPosition;
            }
            Vector3 vector = GUICamera.ScreenToGUIPoint(ItemTooltipDlg_Second.MOBILE_TOOLTIP_POS);
            Vector2 size2  = cForm.GetSize();
            if (NrTSingleton <FormsManager> .Instance.IsShow(G_ID.ITEMTOOLTIP_SECOND_DLG))
            {
                Form form = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.ITEMTOOLTIP_SECOND_DLG);

                float x3 = vector.x;
                float y  = vector.y;
                form.SetLocation(x3 + size2.x + 2f, y);
                cForm.SetLocation(x3, y);
            }
            else
            {
                float x3 = vector.x;
                float y  = vector.y;
                cForm.SetLocation(x3, y);
            }
        }
    }
コード例 #2
0
        public Vector3 GetEffectUIPos(Vector2 ScreenPos)
        {
            Vector3 result = GUICamera.ScreenToGUIPoint(ScreenPos);

            result.y = -result.y;
            result.z = UIPanelManager.EFFECT_UI_DEPTH;
            return(result);
        }
コード例 #3
0
    public Vector3 WorldToEZ(Vector3 Pos)
    {
        Camera main = Camera.main;

        if (null != main)
        {
            Pos = main.WorldToScreenPoint(Pos);
        }
        Pos.y = (float)Screen.height - Pos.y;
        Pos   = GUICamera.ScreenToGUIPoint(Pos);
        return(Pos);
    }
コード例 #4
0
 public override void SetComponent()
 {
     this.m_ListBox_ListBox            = new ListBox[3];
     this.m_ItemsCount                 = new int[3];
     this.m_DrawTexture_Line           = new DrawTexture[2];
     this.m_DrawTexture_ListBG1        = (base.GetControl("DrawTexture_ListBG1") as DrawTexture);
     this.m_DrawTexture_Name1          = (base.GetControl("DrawTexture_Name1") as DrawTexture);
     this.m_ListBox_ListBox[0]         = (base.GetControl("ListBox_ListBox0") as ListBox);
     this.m_ListBox_ListBox[0].Reserve = false;
     this.m_ListBox_ListBox[1]         = (base.GetControl("ListBox_ListBox1") as ListBox);
     this.m_ListBox_ListBox[1].Reserve = false;
     this.m_ListBox_ListBox[2]         = (base.GetControl("ListBox_ListBox2") as ListBox);
     this.m_ListBox_ListBox[2].Reserve = false;
     this.m_Label_Label4               = (base.GetControl("Label_Label4") as Label);
     this.m_DrawTexture_Line[0]        = (base.GetControl("DrawTexture_Line1") as DrawTexture);
     this.m_DrawTexture_Line[1]        = (base.GetControl("DrawTexture_Line2") as DrawTexture);
     for (int i = 0; i < 3; i++)
     {
         if (this.m_ListBox_ListBox[i].slider != null)
         {
             UnityEngine.Object.Destroy(this.m_ListBox_ListBox[i].slider.gameObject);
         }
         this.m_ListBox_ListBox[i].OffsetX = 0f;
         if (TsPlatform.IsMobile)
         {
             this.m_ListBox_ListBox[i].LineHeight = 80f;
             this.m_ListBox_ListBox[i].ColumnNum  = 1;
             this.m_ListBox_ListBox[i].SetColumnWidth((int)this.m_ListBox_ListBox[i].GetSize().x, 0, 0, 0, 0, 32f);
         }
         else
         {
             this.m_ListBox_ListBox[i].LineHeight = 20f;
             this.m_ListBox_ListBox[i].ColumnNum  = 1;
             this.m_ListBox_ListBox[i].SetColumnWidth((int)this.m_ListBox_ListBox[i].GetSize().x, 0, 0, 0, 0);
         }
         this.m_ListBox_ListBox[i].AddValueChangedDelegate(new EZValueChangedDelegate(this.ListBoxSelect));
         this.m_ListBox_ListBox[i].AddLongTapDelegate(new EZValueChangedDelegate(this.ListBoxSelect));
     }
     if (TsPlatform.IsWeb || TsPlatform.IsEditor || TsPlatform.IsAndroid)
     {
         float x   = NkInputManager.mousePosition.x;
         float num = GUICamera.height - NkInputManager.mousePosition.y;
         base.SetLocation((float)((int)x), (float)((int)num));
     }
     else
     {
         Vector3 vector = GUICamera.ScreenToGUIPoint(new Vector3(NkInputManager.GetTouch(0).position.x, GUICamera.height - NkInputManager.GetTouch(0).position.y, 1f));
         base.SetLocation((float)((int)vector.x), (float)((int)vector.y));
     }
 }
コード例 #5
0
    public static Vector3 WorldToEZ(Vector3 Pos)
    {
        Camera main = Camera.main;

        if (null != main)
        {
            Vector3 rhs = Pos - main.transform.position;
            float   num = Vector3.Dot(main.transform.forward, rhs);
            if (num < 0f)
            {
                float y = -2000f;
                Pos   = Vector3.zero;
                Pos.y = y;
                return(Pos);
            }
            Pos = main.WorldToScreenPoint(Pos);
        }
        Pos.y = (float)Screen.height - Pos.y;
        Pos   = GUICamera.ScreenToGUIPoint(Pos);
        return(Pos);
    }
コード例 #6
0
ファイル: Tooltip_Dlg.cs プロジェクト: parikharsh/GLOH_Source
    public static void Tooltip_Rect(Form cForm, Vector3 showPosition)
    {
        if (!TsPlatform.IsMobile || (showPosition == Vector3.zero && Tooltip_Dlg.MOBILE_TOOLTIP_POS == Vector3.zero))
        {
            float   num    = 20f;
            Vector3 vector = GUICamera.ScreenToGUIPoint(NkInputManager.mousePosition);
            Vector2 size   = cForm.GetSize();
            if (NrTSingleton <FormsManager> .Instance.IsShow(G_ID.TOOLTIP_SECOND_DLG))
            {
                Form form = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.TOOLTIP_SECOND_DLG);

                Vector2 size2 = form.GetSize();
                float   num2  = vector.x + num;
                if (num2 + size.x + 2f + size2.x > GUICamera.width)
                {
                    num2 = vector.x - num - size.x - 2f - size2.x;
                }
                float num3 = GUICamera.height - vector.y;
                if (num3 + size.y > GUICamera.height)
                {
                    float num4 = num3 + size.y - GUICamera.height;
                    num3 -= num4;
                }
                form.SetLocation(num2 + size.x + 2f, num3);
                cForm.SetLocation(num2, num3);
            }
            else
            {
                float num2 = vector.x + num;
                if (num2 + size.x > GUICamera.width)
                {
                    num2 = vector.x - num - size.x;
                }
                float num3 = GUICamera.height - vector.y;
                if (num3 + size.y > GUICamera.height)
                {
                    float num5 = num3 + size.y - GUICamera.height;
                    num3 -= num5;
                }
                cForm.SetLocation(num2, num3);
            }
        }
        else
        {
            if (showPosition != Vector3.zero && Tooltip_Dlg.MOBILE_TOOLTIP_POS == Vector3.zero)
            {
                showPosition.y = -showPosition.y;
                Tooltip_Dlg.MOBILE_TOOLTIP_POS = showPosition;
            }
            Vector3 vector = GUICamera.ScreenToGUIPoint(Tooltip_Dlg.MOBILE_TOOLTIP_POS);
            Vector2 size3  = cForm.GetSize();
            if (NrTSingleton <FormsManager> .Instance.IsShow(G_ID.TOOLTIP_SECOND_DLG))
            {
                Form form2 = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.TOOLTIP_SECOND_DLG);

                float x = vector.x;
                float y = vector.y;
                form2.SetLocation(x + size3.x + 2f, y);
                cForm.SetLocation(x, y);
            }
            else
            {
                float x = vector.x;
                float y = vector.y;
                cForm.SetLocation(x, y);
            }
        }
    }