예제 #1
0
        public Message InitMessage(string message = "", PriorityInfo priority = PriorityInfo.Debug)
        {
            Message messageInfo = new Message()
            {
                Priority      = priority,
                Datetime      = DateTime.Now,
                CurrentThread = _Thread == 1 ? System.Threading.Thread.CurrentThread.ManagedThreadId : 0,
                MessageInfo   = message
            };

            _Message = messageInfo;
            return(messageInfo);
        }
예제 #2
0
    private PriorityInfo GetPriorityInfo(int priority)
    {
        PriorityInfo result = default(PriorityInfo);

        for (int i = 0; i < JobsTableScreen.priorityInfo.Count; i++)
        {
            PriorityInfo priorityInfo = JobsTableScreen.priorityInfo[i];
            if (priorityInfo.priority == priority)
            {
                return(JobsTableScreen.priorityInfo[i]);
            }
        }
        return(result);
    }
예제 #3
0
    private LocString GetPriorityStr(int priority)
    {
        priority = Mathf.Clamp(priority, 0, 5);
        LocString result = null;

        foreach (PriorityInfo item in priorityInfo)
        {
            PriorityInfo current = item;
            if (current.priority == priority)
            {
                result = current.name;
            }
        }
        return(result);
    }
예제 #4
0
    private void UpdateWidget(GameObject widget_go, ChoreGroup chore_group, IPersonalPriorityManager priority_mgr)
    {
        int  fgIndex = 0;
        int  value   = 0;
        bool flag    = priority_mgr.IsChoreGroupDisabled(chore_group);

        if (!flag)
        {
            value = priority_mgr.GetPersonalPriority(chore_group);
        }
        value = Mathf.Clamp(value, 0, 5);
        for (int i = 0; i < JobsTableScreen.priorityInfo.Count - 1; i++)
        {
            PriorityInfo priorityInfo = JobsTableScreen.priorityInfo[i];
            if (priorityInfo.priority == value)
            {
                fgIndex = i;
                break;
            }
        }
        OptionSelector component  = widget_go.GetComponent <OptionSelector>();
        int            num        = priority_mgr?.GetAssociatedSkillLevel(chore_group) ?? 0;
        Color32        fillColour = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, 128);

        if (num > 0)
        {
            float num2 = (float)(num - skillLevelLow);
            num2      /= (float)(skillLevelHigh - skillLevelLow);
            fillColour = Color32.Lerp(skillOutlineColourLow, skillOutlineColourHigh, num2);
        }
        component.ConfigureItem(flag, new OptionSelector.DisplayOptionInfo
        {
            bgOptions  = null,
            fgOptions  = prioritySprites,
            bgIndex    = 0,
            fgIndex    = fgIndex,
            fillColour = fillColour
        });
        ToolTip componentInChildren = widget_go.transform.GetComponentInChildren <ToolTip>();

        if ((UnityEngine.Object)componentInChildren != (UnityEngine.Object)null)
        {
            componentInChildren.toolTip      = HoverPersonalPriority(widget_go);
            componentInChildren.forceRefresh = true;
        }
    }
예제 #5
0
    private void InitializeHeader(ChoreGroup chore_group, GameObject widget_go)
    {
        HierarchyReferences component           = widget_go.GetComponent <HierarchyReferences>();
        HierarchyReferences hierarchyReferences = component.GetReference("PrioritizationWidget") as HierarchyReferences;
        GameObject          items_root          = hierarchyReferences.GetReference("ItemPanel").gameObject;

        if (items_root.transform.childCount <= 0)
        {
            items_root.SetActive(false);
            LocText locText = component.GetReference("Label") as LocText;
            locText.text = chore_group.Name;
            KButton    kButton    = component.GetReference("PrioritizeButton") as KButton;
            Selectable selectable = items_root.GetComponent <Selectable>();
            kButton.onClick += delegate
            {
                selectable.Select();
                items_root.SetActive(true);
            };
            GameObject gameObject = hierarchyReferences.GetReference("ItemTemplate").gameObject;
            for (int num = 5; num >= 0; num--)
            {
                PriorityInfo priorityInfo = GetPriorityInfo(num);
                if (priorityInfo.name != null)
                {
                    GameObject          gameObject2 = Util.KInstantiateUI(gameObject, items_root, true);
                    KButton             component2  = gameObject2.GetComponent <KButton>();
                    HierarchyReferences component3  = gameObject2.GetComponent <HierarchyReferences>();
                    KImage  kImage       = component3.GetReference("Icon") as KImage;
                    LocText locText2     = component3.GetReference("Label") as LocText;
                    int     new_priority = num;
                    component2.onClick += delegate
                    {
                        ChangeColumnPriority(widget_go, new_priority);
                        UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(null);
                    };
                    kImage.sprite = priorityInfo.sprite;
                    locText2.text = priorityInfo.name;
                }
            }
        }
    }
예제 #6
0
    protected override void OnActivate()
    {
        Instance = this;
        title    = UI.JOBSSCREEN.TITLE;
        base.OnActivate();
        resetSettingsButton.onClick += OnResetSettingsClicked;
        prioritySprites              = new List <Sprite>();
        foreach (PriorityInfo item in priorityInfo)
        {
            PriorityInfo current = item;
            prioritySprites.Add(current.sprite);
        }
        AddPortraitColumn("Portrait", base.on_load_portrait, null, true);
        AddButtonLabelColumn("Names", ConfigureNameLabel, base.get_value_name_label, delegate(GameObject widget_go)
        {
            GetWidgetRow(widget_go).SelectMinion();
        }, delegate(GameObject widget_go)
        {
            GetWidgetRow(widget_go).SelectAndFocusMinion();
        }, base.compare_rows_alphabetical, null, base.on_tooltip_sort_alphabetically, false);
        List <ChoreGroup> list = new List <ChoreGroup>(Db.Get().ChoreGroups.resources);
        from @group in list
        orderby @group.DefaultPersonalPriority descending, @group.Name
        select @group;

        foreach (ChoreGroup item2 in list)
        {
            PrioritizationGroupTableColumn new_column = new PrioritizationGroupTableColumn(item2, LoadValue, ChangePersonalPriority, HoverPersonalPriority, ChangeColumnPriority, HoverChangeColumnPriorityButton, OnSortClicked, OnSortHovered);
            RegisterColumn(item2.Id, new_column);
        }
        PrioritizeRowTableColumn new_column2 = new PrioritizeRowTableColumn(null, ChangeRowPriority, HoverChangeRowPriorityButton);

        RegisterColumn("prioritize_row", new_column2);
        settingsButton.onClick           += OnSettingsButtonClicked;
        resetSettingsButton.onClick      += OnResetSettingsClicked;
        toggleAdvancedModeButton.onClick += OnAdvancedModeToggleClicked;
        toggleAdvancedModeButton.fgImage.gameObject.SetActive(Game.Instance.advancedPersonalPriorities);
        RefreshEffectListeners();
    }
예제 #7
0
 /// <summary>
 /// Set a number of retries for the external task.
 /// </summary>
 public virtual Task SetPriority(string externalTaskId, PriorityInfo priorityInfo) => _api.SetPriority(externalTaskId, priorityInfo);
예제 #8
0
        public void InsertAsync(string message, PriorityInfo priority)
        {
            Message messageInfo = InitMessage(message, priority);

            Insert(messageInfo);
        }