Exemplo n.º 1
0
 internal Layout(Widget parent, FString name, String file_name, bool visible)
 {
     mFileName = file_name;
     mLayoutName = name;
     mVisible = visible;
     mParent = parent;
 }
Exemplo n.º 2
0
 internal Widget(Instance inst, FString name, Layout parent, WidgetType type)
 {
     mInstance = inst;
     mType = type;
     mName = name;
     mParentLayout = parent;
 }
Exemplo n.º 3
0
 /// <summary>
 /// 加载界面资源
 /// </summary>
 /// <param name="layout_name">界面名称</param>
 /// <returns>结果</returns>
 public static ExecuteResult LoadLayoutResource(FString layout_name)
 {
     Layout layout;
     if (sRegWinTable.GetLayout(layout_name, out layout))
     {
         if (!layout.IsLoaded)
         {
             layout.Load();
         }
         return setResult(ExecuteResult.Success);
     }
     return setResult(ExecuteResult.LayoutNotExist);
 }
Exemplo n.º 4
0
 /// <summary>
 /// 注册界面(Layout)函数
 /// </summary>
 /// <param name="layout_name">你为这个界面起的名字(会作为后面界面操作的索引关键字)</param>
 /// <param name="file_name">这个界面的.layout文件名</param>
 /// <param name="delay_load">是否延时加载</param>
 /// <param name="visible">是否默认可见</param>
 public static ExecuteResult RegisterLayout(FString layout_name, String file_name, bool delay_load, bool visible)
 {
     if (sRegWinTable.ContainKey(layout_name))
     {
         return setResult(ExecuteResult.ReregError);
     }
     Layout layout = new Layout(layout_name, file_name, visible);
     sRegWinTable.Add(layout);
     if (!delay_load)
     {
         layout.Load();
     }
     return setResult(ExecuteResult.Success);
 }
Exemplo n.º 5
0
            /// <summary>
            /// 设置改变对象坐标事件
            /// </summary>
            /// <param name="layout_name">界面名称</param>
            /// <param name="widget_name">控件名称</param>
            /// <param name="func">事件委托</param>
            /// <param name="control">控制属性</param>
            /// <returns>结果</returns>
            public static ExecuteResult SetChangeItemPosition(FString layout_name, FString widget_name, Event.SenderInt func, EventControl control)
            {
                ItemBox ib = null;
                ExecuteResult ret = FindUI(layout_name, widget_name, out ib);
                if (ExecuteResult.Success == ret)
                {

                    switch (control)
                    {
                        case EventControl.Add:
                            {
                                ib.EventChangeItemPosition += func;
                            }
                            break;
                        case EventControl.Remove:
                            {
                                ib.EventChangeItemPosition -= func;
                            }
                            break;
                    }
                }
                return ret;
            }
Exemplo n.º 6
0
            /// <summary>
            /// 设置请求对象坐标事件
            /// </summary>
            /// <param name="layout_name">界面名称</param>
            /// <param name="widget_name">控件名称</param>
            /// <param name="func">事件委托</param>
            /// <param name="control">控制属性</param>
            /// <returns>结果</returns>
            public static ExecuteResult SetEventRequestCoordItem(FString layout_name, FString widget_name, Event.SenderRefIntCoordBool func, EventControl control)
            {
                ItemBox ib = null;
                ExecuteResult ret = FindUI(layout_name, widget_name, out ib);
                if (ExecuteResult.Success == ret)
                {

                    switch (control)
                    {
                        case EventControl.Add:
                            {
                                ib.RequestCoordItem = func;
                            }
                            break;
                        case EventControl.Remove:
                            {
                                ib.RequestCoordItem = null;
                            }
                            break;
                    }
                }
                return ret;
            }
Exemplo n.º 7
0
 public void Remove(FString layout_name)
 {
     mLayoutTable.Remove(layout_name);
 }
Exemplo n.º 8
0
 internal Window(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.Window)
 {
 }
Exemplo n.º 9
0
 internal Layout(FString name, String file_name, bool visible)
 {
     mFileName   = file_name;
     mLayoutName = name;
     mVisible    = visible;
 }
Exemplo n.º 10
0
 internal bool Contains(FString widget_name)
 {
     return(mChilds.Contains(widget_name));
 }
Exemplo n.º 11
0
        /// <summary>
        /// 注册界面(Layout)函数
        /// </summary>
        /// <param name="parent_layout_name">父界面名称</param>
        /// <param name="parent_widget_name">挂载在父界面的具体哪一个UI控件之下</param>
        /// <param name="layout_name">你为这个界面起的名字(会作为后面界面操作的索引关键字)</param>
        /// <param name="file_name">这个界面的.layout文件名</param>
        /// <param name="delay_load">是否延时加载</param>
        /// <param name="visible">是否默认可见</param>
        public static ExecuteResult RegisterLayout(FString parent_layout_name, FString parent_widget_name, FString layout_name, String file_name, bool delay_load, bool visible)
        {
            if (sRegWinTable.ContainKey(layout_name))
            {
                return(setResult(ExecuteResult.ReregError));
            }
            Layout parent_layout = null;
            Widget parent_widget = null;

            if (sRegWinTable.GetLayout(parent_layout_name, out parent_layout))
            {
                if (!parent_layout.IsLoaded)
                {
                    parent_layout.Load();
                }
                if (null == parent_widget_name)
                {
                    parent_widget = parent_layout.Root;
                }
                else
                {
                    parent_layout.FindWidget(parent_widget_name, out parent_widget);
                }
                Layout layout = new Layout(parent_widget, layout_name, file_name, visible);
                sRegWinTable.Add(layout);
                if (!delay_load)
                {
                    layout.Load();
                }
            }
            return(setResult(ExecuteResult.Success));
        }
Exemplo n.º 12
0
        internal static Widget CreateWidget(Instance inst, FString name, Layout parent_layout)
        {
            WidgetType type = ICall_getType(inst.Ptr);

            Widget widget = null;

            switch (type)
            {
            case WidgetType.Widget:
                widget = new Widget(inst, name, parent_layout, WidgetType.Widget);
                break;

            case WidgetType.ImageBox:
                widget = new ImageBox(inst, name, parent_layout);
                break;

            case WidgetType.Window:
                widget = new Window(inst, name, parent_layout);
                break;

            case WidgetType.TextBox:
                widget = new TextBox(inst, name, parent_layout);
                break;

            case WidgetType.ListBox:
                widget = new ListBox(inst, name, parent_layout);
                break;

            case WidgetType.Button:
                widget = new Button(inst, name, parent_layout);
                break;

            case WidgetType.EditBox:
                widget = new EditBox(inst, name, parent_layout);
                break;

            case WidgetType.ComboBox:
                widget = new ComboBox(inst, name, parent_layout);
                break;

            case WidgetType.ScrollBar:
                widget = new ScrollBar(inst, name, parent_layout);
                break;

            case WidgetType.DDContainer:
                widget = new DDContainer(inst, name, parent_layout);
                break;

            case WidgetType.ItemBox:
                widget = new ItemBox(inst, name, parent_layout);
                break;

            case WidgetType.Canvas:
                widget = new Canvas(inst, name, parent_layout);
                break;

            default:
                widget = new Widget(inst, name, parent_layout, WidgetType.Unknown);
                break;
            }
            return(widget);
        }
Exemplo n.º 13
0
 internal Button(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.Button)
 {
 }
Exemplo n.º 14
0
 /// <summary>
 /// 判断两个FString 是否相等
 /// </summary>
 /// <param name="ls">FString</param>
 /// <param name="rs">FString</param>
 /// <returns>相等true,不相等false</returns>
 internal static bool Equals(FString ls, FString rs)
 {
     if (ReferenceEquals(ls, null))
     {
         return ReferenceEquals(rs, null);
     }
     else if (ReferenceEquals(rs, null))
     {
         return false;
     }
     return (ls.mID == rs.mID);
 }
Exemplo n.º 15
0
 internal DDContainer(Instance inst, FString name, Layout parent, WidgetType type)
     : base(inst, name, parent, type)
 {
 }
Exemplo n.º 16
0
 internal Button(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.Button)
 {
 }
Exemplo n.º 17
0
 internal Window(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.Window)
 {
 }
Exemplo n.º 18
0
            /// <summary>
            /// 设置记录事件
            /// </summary>
            /// <param name="layout_name">界面名称</param>
            /// <param name="widget_name">控件名称</param>
            /// <param name="func">事件委托</param>
            /// <param name="control">控制属性</param>
            /// <returns>结果</returns>
            public static ExecuteResult SetEventTick(FString layout_name, FString widget_name, Event.SenderTick func, EventControl control)
            {
                Widget widget = null;
                ExecuteResult ret = FindWidget(layout_name, widget_name, out widget);
                if (ExecuteResult.Success == ret)
                {

                    switch (control)
                    {
                        case EventControl.Add:
                            {
                                widget.EventTick += func;
                            }
                            break;
                        case EventControl.Remove:
                            {
                                widget.EventTick -= func;
                            }
                            break;
                    }
                }
                return ret;
            }
Exemplo n.º 19
0
 internal TextBox(Instance inst, FString name, Layout parent, WidgetType type)
     : base(inst, name, parent, type)
 {
 }
Exemplo n.º 20
0
 /// <summary>
 /// 未注册界面
 /// </summary>
 /// <param name="layout_name">界面名称</param>
 public static void UnregisterLayout(FString layout_name)
 {
     Layout layout;
     if (sRegWinTable.GetLayout(layout_name, out layout))
     {
         sRegWinTable.Remove(layout_name);
         layout.Unload();
     }
 }
 public bool GetWidget(FString widget_name, out Widget widget)
 {
     return(mWidgetTable.TryGetValue(widget_name, out widget));
 }
Exemplo n.º 22
0
 internal void Clear()
 {
     mParent = null;
     mItem = null;
     mLayoutName = null;
 }
 public bool Contains(FString widget_name)
 {
     return(mWidgetTable.ContainsKey(widget_name));
 }
Exemplo n.º 24
0
 public bool GetWidget(FString widget_name, out Widget widget)
 {
     return mWidgetTable.TryGetValue(widget_name, out widget);
 }
Exemplo n.º 25
0
 internal bool Contains(FString widget_name)
 {
     return mChilds.Contains(widget_name);
 }
Exemplo n.º 26
0
 internal TextBox(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.TextBox)
 {
 }
Exemplo n.º 27
0
 internal bool FindWidget(FString widget_name, out Widget widget)
 {
     if (mChilds.GetWidget(widget_name, out widget))
      {
          return true;
      }
      else
      {
         Instance inst = GUI.FindWidget(mWidget.Instance.Ptr, widget_name.Name);
         if (inst.IsValid)
         {
             widget = Widget.CreateWidget(inst, widget_name.Name, this);
             mChilds.Add(widget);
             return true;
         }
         else
         {
             widget = null;
             return false;
         }
     }
 }
Exemplo n.º 28
0
 internal void RemoveWidget(FString widget_name)
 {
     mChilds.Remove(widget_name);
 }
Exemplo n.º 29
0
 internal void RemoveWidget(FString widget_name)
 {
     mChilds.Remove(widget_name);
 }
Exemplo n.º 30
0
 internal EditBox(Instance inst, FString name, Layout parent, WidgetType type)
     : base(inst, name, parent, type)
 {
 }
Exemplo n.º 31
0
 internal Layout(FString name, String file_name, bool visible)
 {
     mFileName = file_name;
     mLayoutName = name;
     mVisible = visible;
 }
Exemplo n.º 32
0
 public bool GetLayout(FString layout_name, out Layout layout)
 {
     return(mLayoutTable.TryGetValue(layout_name, out layout));
 }
Exemplo n.º 33
0
            /// <summary>
            /// 设置通知事件
            /// </summary>
            /// <param name="layout_name">界面名称</param>
            /// <param name="widget_name">控件名称</param>
            /// <param name="func">事件委托</param>
            /// <param name="control">控制属性</param>
            /// <returns>结果</returns>
            public static ExecuteResult SetNotifyItem(FString layout_name, FString widget_name, Event.SenderRefIBNotifyItemData func, EventControl control)
            {
                ItemBox ib = null;
                ExecuteResult ret = FindUI(layout_name, widget_name, out ib);
                if (ExecuteResult.Success == ret)
                {

                    switch (control)
                    {
                        case EventControl.Add:
                            {
                                ib.EventNotifyItem += func;
                            }
                            break;
                        case EventControl.Remove:
                            {
                                ib.EventNotifyItem -= func;
                            }
                            break;
                    }
                }
                return ret;
            }
Exemplo n.º 34
0
 public bool ContainKey(FString key)
 {
     return(mLayoutTable.ContainsKey(key));
 }
Exemplo n.º 35
0
 public bool ContainKey(FString key)
 {
     return mLayoutTable.ContainsKey(key);
 }
Exemplo n.º 36
0
 /// <summary>
 /// 设置界面是否可见
 /// </summary>
 /// <param name="layout_name">界面名称</param>
 /// <param name="visible">是否可见</param>
 /// <returns>结果</returns>
 public static ExecuteResult SetLayoutVisible(FString layout_name, bool visible)
 {
     Layout layout;
     if (sRegWinTable.GetLayout(layout_name, out layout))
     {
         if (!layout.IsLoaded)
         {
             layout.Load();
         }
         layout.Visible = visible;
         return setResult(ExecuteResult.Success);
     }
     return setResult(ExecuteResult.LayoutNotExist);
 }
Exemplo n.º 37
0
 public void Remove(FString layout_name)
 {
     mLayoutTable.Remove(layout_name);
 }
Exemplo n.º 38
0
        internal static Widget CreateWidget(Instance inst, FString name, Layout parent_layout)
        {
            WidgetType type = ICall_getType(inst.Ptr);

            Widget widget = null;
            switch (type)
            {
                case WidgetType.Widget:
                    widget = new Widget(inst, name, parent_layout, WidgetType.Widget);
                    break;
                case WidgetType.ImageBox:
                    widget = new ImageBox(inst, name, parent_layout);
                    break;
                case WidgetType.Window:
                    widget = new Window(inst, name, parent_layout);
                    break;
                case WidgetType.TextBox:
                    widget = new TextBox(inst, name, parent_layout);
                    break;
                case WidgetType.ListBox:
                    widget = new ListBox(inst, name, parent_layout);
                    break;
                case WidgetType.Button:
                    widget = new Button(inst, name, parent_layout);
                    break;
                case WidgetType.EditBox:
                    widget = new EditBox(inst, name, parent_layout);
                    break;
                case WidgetType.ComboBox:
                    widget = new ComboBox(inst, name, parent_layout);
                    break;

                case WidgetType.ScrollBar:
                    widget = new ScrollBar(inst, name, parent_layout);
                    break;
                case WidgetType.DDContainer:
                    widget = new DDContainer(inst, name, parent_layout);
                    break;
                case WidgetType.ItemBox:
                    widget = new ItemBox(inst, name, parent_layout);
                    break;
                case WidgetType.Canvas:
                    widget = new Canvas(inst, name, parent_layout);
                    break;
                default:
                    widget = new Widget(inst, name, parent_layout, WidgetType.Unknown);
                    break;
            }
            return widget;
        }
Exemplo n.º 39
0
            /// <summary>
            /// 设置鼠标双击或接收回车键的事件操作
            /// </summary>
            /// <param name="layout_name">面板名称</param>
            /// <param name="widget_name">控件名称</param>
            /// <param name="func">事件操作代理</param>
            /// <param name="control">事件控制方式</param>
            /// <returns>执行结果,若结果为Success,则表示操作成功;否则,表示操作失败</returns>
            public static ExecuteResult SetListSelectAccept(FString layout_name, FString widget_name, Event.SenderInt func, EventControl control)
            {
                ListBox lb = null;
                ExecuteResult ret = FindUI(layout_name, widget_name, out lb);
                if (ExecuteResult.Success == ret)
                {

                    switch (control)
                    {
                        case EventControl.Add:
                            {
                                lb.EventListSelectAccept += func;
                            }
                            break;
                        case EventControl.Remove:
                            {
                                lb.EventListSelectAccept -= func;
                            }
                            break;
                    }
                }
                return ret;
            }
Exemplo n.º 40
0
 /// <summary>
 /// 注册界面(Layout)函数
 /// </summary>
 /// <param name="parent_layout_name">父界面名称</param>
 /// <param name="parent_widget_name">挂载在父界面的具体哪一个UI控件之下</param>
 /// <param name="layout_name">你为这个界面起的名字(会作为后面界面操作的索引关键字)</param>
 /// <param name="file_name">这个界面的.layout文件名</param>
 /// <param name="delay_load">是否延时加载</param>
 /// <param name="visible">是否默认可见</param>
 public static ExecuteResult RegisterLayout(FString parent_layout_name, FString parent_widget_name, FString layout_name, String file_name, bool delay_load, bool visible)
 {
     if (sRegWinTable.ContainKey(layout_name))
     {
         return setResult(ExecuteResult.ReregError);
     }
     Layout parent_layout = null;
     Widget parent_widget = null;
     if (sRegWinTable.GetLayout(parent_layout_name, out parent_layout))
     {
         if (!parent_layout.IsLoaded)
         {
             parent_layout.Load();
         }
         if (null == parent_widget_name)
         {
             parent_widget = parent_layout.Root;
         }
         else
         {
             parent_layout.FindWidget(parent_widget_name, out parent_widget);
         }
         Layout layout = new Layout(parent_widget, layout_name, file_name, visible);
         sRegWinTable.Add(layout);
         if (!delay_load)
         {
             layout.Load();
         }
     }
     return setResult(ExecuteResult.Success);
 }
Exemplo n.º 41
0
 internal Canvas(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.Canvas)
 {
 }
Exemplo n.º 42
0
 public bool GetLayout(FString layout_name, out Layout layout)
 {
     return mLayoutTable.TryGetValue(layout_name, out layout);
 }
Exemplo n.º 43
0
 internal ScrollBar(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.ScrollBar)
 {
 }
Exemplo n.º 44
0
 internal ScrollBar(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.ScrollBar)
 {
 }
Exemplo n.º 45
0
 public bool Contains(FString widget_name)
 {
     return mWidgetTable.ContainsKey(widget_name);
 }
Exemplo n.º 46
0
 internal ItemBox(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.ItemBox)
 {
 }
Exemplo n.º 47
0
 internal Canvas(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.Canvas)
 {
 }