Beispiel #1
0
 public static string GetUIPerfabPath(UICategory ui)
 {
     if (UIPrefabPathList.ContainsKey(ui))
     {
         return(UIPrefabPathList[ui]);
     }
     return("");
 }
Beispiel #2
0
    public void HideCategoryList()
    {
        UICategory uICategory = gameObject.GetComponentInParent <UICategory>();

        if (uICategory != null)
        {
            uICategory.HideCategory();
        }
    }
Beispiel #3
0
 public void Set(UICategory category, UserControl uc)
 {
     if (DicUserControl.ContainsKey(category))
     {
         DicUserControl.Remove(category);
     }
     DicUserControl.Add(category, uc);
     uc.Visibility = Visibility.Collapsed;
 }
 static int GetCategory(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UIManager  obj  = (UIManager)ToLua.CheckObject(L, 1, typeof(UIManager));
         string     arg0 = ToLua.CheckString(L, 2);
         UICategory o    = obj.GetCategory(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    private void InitUIFrameworkInternal(GameObject prefab)
    {
        UI_Root = Object.Instantiate(prefab);

        foreach (var pair in m_uiCategoryConfigMap)
        {
            var ins      = Utils.AddChild(UI_Root.transform, pair.Key);
            var category = new UICategory()
            {
                Name       = pair.Key,
                RootObject = ins,
                m_Config   = pair.Value
            };
            category.Init();

            m_UICategoryMap.Add(pair.Key, category);
        }

        Object.DontDestroyOnLoad(UI_Root);
    }
Beispiel #6
0
        public void InitializeChannels()
        {
            gridChannels.Clear();

            foreach (DiscordChannel channel in DTT.Instance.currentGuild.Channels)
            {
                if (channel.IsCategory && channel.Children.Any(x => x.CanJoin()))
                {
                    UICategory uiCategory = new UICategory(channel);
                    uiCategory.Width.Precent = 1;
                    uiCategory.Height.Pixels = 20;
                    gridChannels.Add(uiCategory);
                }
                else if (!channel.IsCategory && !channel.ParentId.HasValue && channel.CanJoin())
                {
                    UIChannel uiChild = new UIChannel(channel);
                    uiChild.Width.Precent = 1;
                    uiChild.Height.Pixels = 20;
                    uiChild.OnClick      += (a, b) =>
                    {
                        DTT.Instance.currentChannel = channel;

                        string name = "#" + channel.Name.Replace("_", "-");
                        textCurrent.SetText(name);
                        textCurrent.Width.Pixels  = name.Measure().X;
                        textCurrent.Height.Pixels = name.Measure().Y;
                        textCurrent.Recalculate();

                        gridMessages.Clear();

                        Utility.DownloadLog(channel);
                    };
                    gridChannels.Add(uiChild);
                }
            }
        }
Beispiel #7
0
        public virtual IActionResult CoreView()
        #region
        {
            string           tmplCode = Request.Query["tmplCode"].ToString();
            string           sql      = "SELECT  * FROM S_UI_List";
            List <S_UI_List> uiLists  = sqlHelper.ExecuteList <S_UI_List>(sql).Where(c => c.Code == tmplCode).ToList();
            S_UI_List        listDef  = uiLists.FirstOrDefault();

            UIBuilder uiFO = new UIBuilder();

            ViewBag.ListHtml      = uiFO.CreateListHtml(tmplCode);
            ViewBag.Script        = uiFO.CreateListScript(tmplCode);
            ViewBag.RightKeyHtml  = "";
            ViewBag.FixedFields   = string.Format("var FixedFields={0};", Newtonsoft.Json.JsonConvert.SerializeObject(uiFO.GetFixedWidthFields(tmplCode)));
            ViewBag.Title         = listDef.Name;
            ViewBag.VirtualScroll = "false";
            var isColumnEdit = false;

            if (!string.IsNullOrEmpty(listDef.LayoutGrid))
            {
                var settings = JsonHelper.ToObject(listDef.LayoutGrid);
                if (settings.GetValue("allowCellEdit") == "true")
                {
                    isColumnEdit = true;
                }
                if (!String.IsNullOrEmpty(settings.GetValue("virtualScroll")))
                {
                    ViewBag.VirtualScroll = settings.GetValue("virtualScroll");
                }
            }

            var tab = new Tab();

            if (!isColumnEdit)
            {
                //不可标签式查询
                var fields = JsonHelper.ToList(listDef.LayoutField);
                foreach (var field in fields)
                {
                    if (!field.ContainsKey("Settings"))
                    {
                        continue;
                    }
                    var settings = JsonHelper.ToObject(field["Settings"].ToString());

                    if (!settings.ContainsKey("EnumKey") || settings["EnumKey"].ToString() == "")
                    {
                        continue;
                    }

                    if (!settings.ContainsKey("TabSearchName") || settings["TabSearchName"].ToString() == "")
                    {
                        continue;
                    }


                    UICategory category = null;

                    //根据配置决定是否显示‘全部’选项
                    var    hasAllAttr = true;
                    string enumKey    = settings["EnumKey"].ToString();

                    if (settings.ContainsKey("ShowAll") && settings["ShowAll"].ToString() == "false" &&
                        settings.ContainsKey("TabSearchDefault") && !String.IsNullOrEmpty(settings["TabSearchDefault"].ToString()))
                    {
                        hasAllAttr = false;
                    }
                    category = CategoryFactory.GetCategoryByString(enumKey, settings["TabSearchName"].ToString(), field["field"].ToString(), hasAllAttr);


                    //默认值
                    if (settings.ContainsKey("TabSearchDefault") && settings["TabSearchDefault"].ToString() != "")
                    {
                        category.SetDefaultItem(settings["TabSearchDefault"].ToString());
                    }
                    else
                    {
                        category.SetDefaultItem();
                    }

                    //多选或单选
                    if (settings.ContainsKey("TabSearchMulti") && settings["TabSearchMulti"].ToString() == "false")
                    {
                        category.Multi = false;
                    }
                    else
                    {
                        category.Multi = true;
                    }

                    tab.Categories.Add(category);
                }
            }

            if (tab.Categories.Count > 0)
            {
                tab.IsDisplay  = true;
                ViewBag.Tab    = tab;
                ViewBag.Layout = "~/Views/Shared/_AutoListLayoutTab.cshtml";
            }
            else
            {
                ViewBag.Layout = "~/Views/Shared/_Layout.cshtml";
            }

            return(View());
        }
        // -------------------------------------- ExecuteLocalDeferredTask
        // -- Allows for execution of tasks after first frame has drawn --
        // -- ExecuteLocalDeferredTask -----------------------------------
        private void ExecuteLocalDeferredTask()
        {
            // -- Calls tasks to be ran from child classes ---------------
            ExecuteDeferredTask();

            if (!idConfig.AAIConfiguration().enableAnimation)
            {
                return;
            }
            var index = 0;

            categoryList.ForEach(x =>
            {
                if (x is null)
                {
                    return;
                }
                dynamic categoryFoldout;
                if (isAnimated)
                {
                    categoryFoldout = (AnimatedFoldout)x;
                }
                else
                {
                    categoryFoldout = (Foldout)x;
                }
                var catList         = classDataDictionary[keyData[0]].categoryList;
                UICategory category = null;
                for (var i = 0; i < catList.Count; i++)
                {
                    var e = catList[i];
                    if (e.category != categoryFoldout.name)
                    {
                        continue;
                    }
                    category = e;
                    break;
                }

                var isExpanded = category != null && category.expand || categoryList.Count == 1;
                categoryFoldout.SetValueWithoutNotify(idConfig.AAIConfiguration().expandCategoriesByDefault || isExpanded);

                // -- This creates a cascading expansion effect starting with the first category
                // -- delaying the expansion of the subsequent categories by the delayValue * 1000 (equates to milliseconds)
                var delayedTime = (long)(index * cascadeDelay * 1000);  // @formatter:on
                defaultRoot.schedule.Execute(e =>
                {
                    if (isAnimated)
                    {
                        var foldoutItem = (AnimatedFoldout)categoryFoldout;
                        foldoutItem.SetValueWithoutNotify(categoryFoldout.value);
                        foldoutItem.expander.Activate(categoryFoldout.value);
                    }
                    else
                    {
                        var foldoutItem = (Foldout)categoryFoldout;
                        foldoutItem.SetValueWithoutNotify(categoryFoldout.value);
                    }
                }).StartingIn(delayedTime);
                index++; // @formatter:on
            });
        }
Beispiel #9
0
 public UserControl Get(UICategory category)
 {
     return(DicUserControl[category]);
 }