Example #1
0
 internal Widget(Instance inst, FString name, Layout parent, WidgetType type)
 {
     mInstance = inst;
     mType = type;
     mName = name;
     mParentLayout = parent;
 }
 public bool GetLayout(Instance  layout_inst, out Layout layout)
 {
     foreach (KeyValuePair<FString, Layout> ly in mLayoutTable)
     {
         if (ly.Value.Root.Instance == layout_inst)
         {
             layout = ly.Value;
             return true;
         }
     }
     layout = null;
     return false;
 }
Example #3
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);
 }
 public void Add(Layout layout)
 {
     mLayoutTable.Add(layout.Name, layout);
 }
Example #5
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);
 }
Example #6
0
 internal TextBox(Instance inst, FString name, Layout parent, WidgetType type)
     : base(inst, name, parent, type)
 {
 }
Example #7
0
 internal Window(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.Window)
 {
 }
Example #8
0
 internal ItemBox(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.ItemBox)
 {
 }
Example #9
0
 internal ScrollBar(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.ScrollBar)
 {
 }
Example #10
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;
        }
Example #11
0
 internal static Widget CreateWidget(Instance inst, Layout parent_layout)
 {
     Widget widget = CreateWidget(inst, null, parent_layout);
     widget.mName = GetName(widget.mInstance.Ptr);
     return widget;
 }
 internal DDContainer(Instance inst, FString name, Layout parent, WidgetType type)
     : base(inst, name, parent, type)
 {
 }
Example #13
0
 internal Button(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.Button)
 {
 }
Example #14
0
 internal Window(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.Window)
 {
 }
Example #15
0
 public bool GetLayout(FString layout_name, out Layout layout)
 {
     return mLayoutTable.TryGetValue(layout_name, out layout);
 }
Example #16
0
 internal Canvas(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.Canvas)
 {
 }
 internal ScrollBar(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.ScrollBar)
 {
 }
Example #18
0
 internal ItemBox(Instance inst, FString name, Layout parent)
     : base(inst, name, parent, WidgetType.ItemBox)
 {
 }
Example #19
0
 internal DDContainer(Instance inst, FString name, Layout parent, WidgetType type)
     : base(inst, name, parent, type)
 {
 }