Exemplo n.º 1
0
        public UIElement GetGitPanel()
        {
            var stack = new StackContainer();
            var group = new GroupContainer {
                CaptionHtml = "Git", LabelHeight = "10"
            };

            var gitPathRow    = new RowContainer();
            var repoPathField = new FieldElement {
                CaptionHtml = "Ścieżka do repozytorium", EditValue = "{RepoPath}", OuterWidth = "80"
            };

            gitPathRow.Elements.Add(repoPathField);
            group.Elements.Add(gitPathRow);

            var commandRow       = new RowContainer();
            var invalidPathLabel = new LabelElement {
                CaptionHtml = "{InvalidRepoPathInfo}"
            };
            var getDataCommand = new CommandElement {
                CaptionHtml = "Pobierz dane", MethodName = "GetGitData", OuterWidth = "15"
            };

            commandRow.Elements.Add(getDataCommand);
            commandRow.Elements.Add(invalidPathLabel);
            group.Elements.Add(commandRow);

            stack.Elements.Add(group);
            return(stack);
        }
Exemplo n.º 2
0
        public IEdiInContainer CreateChild(EdiSegmentCollection segs)
        {
            var child = new GroupContainer(segs);

            _groups.Add(child);
            return(child);
        }
Exemplo n.º 3
0
        public UIElement GetSource()
        {
            var stack = new StackContainer();
            var group = new GroupContainer {
                CaptionHtml = "Tytuł grupy", LabelHeight = "10"
            };
            var row    = new RowContainer();
            var rowCmd = new RowContainer();

            var field1 = new FieldElement {
                CaptionHtml = "Pole 1", EditValue = "{Field1}", OuterWidth = "30"
            };
            var field2 = new FieldElement {
                CaptionHtml = "Pole 2", EditValue = "{Field2}", OuterWidth = "30"
            };
            var field3 = new FieldElement {
                CaptionHtml = "Pole 3", EditValue = "{Field3}", OuterWidth = "30"
            };
            var command = new CommandElement {
                CaptionHtml = "Pokaż wartości", MethodName = "ShowFieldValue", Width = "20"
            };

            row.Elements.Add(field1);
            row.Elements.Add(field2);
            row.Elements.Add(field3);
            rowCmd.Elements.Add(command);

            group.Elements.Add(row);
            group.Elements.Add(rowCmd);
            stack.Elements.Add(group);

            return(stack);
        }
Exemplo n.º 4
0
        public UIElement GetCommitPanel()
        {
            var stack = new StackContainer();
            var group = new GroupContainer {
                CaptionHtml = "Commity wybranego autora", LabelHeight = "10", IsReadOnly = "{ReadOnlyMode}"
            };

            var refreshCommandRow = new RowContainer();
            var refreshCommand    = new CommandElement {
                CaptionHtml = "Odśwież", MethodName = "RefreshCommitList", OuterWidth = "15"
            };

            refreshCommandRow.Elements.Add(refreshCommand);
            group.Elements.Add(refreshCommandRow);

            var commitGrid = GridElement.CreatePopulateGrid(CommitRows);

            commitGrid.EditValue    = "{CommitRows}";
            commitGrid.FocusedValue = "{FocusedCommitRow}";
            commitGrid.OuterWidth   = "80";
            group.Elements.Add(commitGrid);

            stack.Elements.Add(group);
            return(stack);
        }
Exemplo n.º 5
0
        public AssignmentsViewModel()
        {
            _dbManager = new DbManager();
            GroupsContainer = new GroupContainer();

            AddAssignmentCommand = new RelayCommand(AddAssignmentMethod);
            RemoveAssignmentCommand = new RelayCommand(RemoveAssignmentMethod);

            UpdateGroupContainer();
        }
Exemplo n.º 6
0
        public DocContainer(EdiSegmentCollection segs, GroupContainer parent)
        {
            _elDelimiter = segs.ElementDelimiter;
            Segments     = segs.SegmentList;
            var els = Segments.First().GetElements(_elDelimiter);

            DocType       = els[1];
            ControlNumber = els[2].CastToInt();
            ParentGroup   = parent;
        }
 // Start is called before the first frame update
 void Start()
 {
     if (Canvas != null)
     {
         controller = Canvas.GetComponent <GroupInformationcontrol>();
     }
     information = GetComponent <TextMeshProUGUI>();
     GroupPanel  = GameObject.FindGameObjectsWithTag("GroupPanel");
     toggle      = GroupPanel[0].GetComponent <GroupContainer>();
 }
Exemplo n.º 8
0
        public async void Reload()
        {
            if (IsLoading)
            {
                return;
            }

            var store           = ServiceContainer.Resolve <IDataStore> ();
            var bus             = ServiceContainer.Resolve <MessageBus> ();
            var userId          = ServiceContainer.Resolve <AuthManager> ().GetUserId();
            var shouldSubscribe = false;

            if (subscriptionDataChange != null)
            {
                shouldSubscribe = true;
                bus.Unsubscribe(subscriptionDataChange);
                subscriptionDataChange = null;
            }

            data.Clear();
            IsLoading = true;
            OnUpdated();

            // Group only items in the past 9 days
            queryStartDate = Time.UtcNow - TimeSpan.FromDays(9);
            var query = store.Table <TimeEntryData> ()
                        .OrderBy(r => r.StartTime, false)
                        .Where(r => r.DeletedAt == null &&
                               r.UserId == userId &&
                               r.State != TimeEntryState.New &&
                               r.StartTime >= queryStartDate);

            // Get new data
            data = await FromQuery(query);

            if (shouldSubscribe)
            {
                subscriptionDataChange = bus.Subscribe <DataChangeMessage> (OnDataChange);
            }

            // Determine if sync is running, if so, delay setting IsLoading to false
            var syncManager = ServiceContainer.Resolve <ISyncManager> ();

            if (!syncManager.IsRunning)
            {
                IsLoading = false;
            }
            else
            {
                subscriptionSyncFinished = bus.Subscribe <SyncFinishedMessage> (OnSyncFinished);
            }
            OnUpdated();
        }
        /// <summary>
        /// Searches the matching shape
        /// </summary>
        /// <param name="spid">The shape ID</param>
        /// <returns>The ShapeContainer</returns>
        public ShapeContainer GetShapeContainer(int spid)
        {
            ShapeContainer ret = null;

            foreach (OfficeArtWordDrawing drawing in this.Drawings)
            {
                GroupContainer group = (GroupContainer)drawing.container.FirstChildWithType <GroupContainer>();
                if (group != null)
                {
                    for (int i = 1; i < group.Children.Count; i++)
                    {
                        Record groupChild = group.Children[i];
                        if (groupChild.TypeCode == 0xF003)
                        {
                            //It's a group of shapes
                            GroupContainer subgroup = (GroupContainer)groupChild;

                            //the referenced shape must be the first shape in the group
                            ShapeContainer container = (ShapeContainer)subgroup.Children[0];
                            Shape          shape     = (Shape)container.Children[1];
                            if (shape.spid == spid)
                            {
                                ret = container;
                                break;
                            }
                        }
                        else if (groupChild.TypeCode == 0xF004)
                        {
                            //It's a singe shape
                            ShapeContainer container = (ShapeContainer)groupChild;
                            Shape          shape     = (Shape)container.Children[0];
                            if (shape.spid == spid)
                            {
                                ret = container;
                                break;
                            }
                        }
                    }
                }
                else
                {
                    continue;
                }

                if (ret != null)
                {
                    break;
                }
            }

            return(ret);
        }
Exemplo n.º 10
0
        public GeneralViewModel()
        {
            _dbManager      = new DbManager();
            GroupsContainer = new GroupContainer();
            UpdateGroupContainer();
            OnPropertyChanged("GroupUsersItems");
            OnPropertyChanged("UserItems");
            OnPropertyChanged("GroupItems");

            UsersCtor();
            GroupsCtor();
            AssignmentsCtor();
        }
Exemplo n.º 11
0
        private void DoLoadChildren(StructInstance instance, InstanceTreeNode parent, Stream stream,
                                    long?offset, int count)
        {
            StructInstance lastChild = instance.LastChild;
            string         groupName = GetStringAttribute("group");

            if (groupName != null)
            {
                GroupContainer container = new GroupContainer(parent, groupName);
                parent.AddChild(container);
                parent = container;
            }

            if (count == 0)
            {
                return;
            }

            StructDef childDef = GetStructAttribute("struct");

            if (childDef == null)
            {
                childDef = _structDef;
            }

            StructInstance childInstance;
            bool           followChildren = GetBoolAttribute("followchildren");

            if (offset.HasValue)
            {
                childInstance = new StructInstance(childDef, parent, stream, offset.Value);
            }
            else
            {
                bool firstFollowChildren = followChildren && lastChild != parent;
                childInstance = new StructInstance(childDef, parent, stream, lastChild, firstFollowChildren);
            }
            parent.AddChild(childInstance);
            if (count > 1)
            {
                childInstance.SequenceIndex = 0;
            }

            for (int i = 1; i < count; i++)
            {
                var nextInstance = new StructInstance(childDef, parent, stream, childInstance, followChildren);
                parent.AddChild(nextInstance);
                nextInstance.SequenceIndex = i;
                childInstance = nextInstance;
            }
        }
Exemplo n.º 12
0
        private GroupContainer GetGroup(IDictionary <TGroupKey, GroupContainer> groupCaches, TGroupKey key)
        {
            var cached = groupCaches.Lookup(key);

            if (cached.HasValue)
            {
                return(cached.Value);
            }

            var newcache = new GroupContainer(key);

            groupCaches[key] = newcache;
            return(newcache);
        }
Exemplo n.º 13
0
        public async void Reload()
        {
            if (IsLoading)
            {
                return;
            }

            var bus             = ServiceContainer.Resolve <MessageBus> ();
            var shouldSubscribe = false;

            if (subscriptionModelChanged != null)
            {
                shouldSubscribe = true;
                bus.Unsubscribe(subscriptionModelChanged);
                subscriptionModelChanged = null;
            }

            data.Clear();
            IsLoading = true;
            OnUpdated();

            // Group only items in the past 9 days
            queryStartDate = Time.UtcNow - TimeSpan.FromDays(9);
            var query = Model.Query <TimeEntryModel> ()
                        .NotDeleted()
                        .ForCurrentUser()
                        .Where((e) => e.State != TimeEntryState.New && e.StartTime >= queryStartDate)
                        .OrderBy((e) => e.StartTime, false);

            // Get new data
            data = await Task.Factory.StartNew(() => FromQuery (query));

            if (shouldSubscribe)
            {
                subscriptionModelChanged = bus.Subscribe <ModelChangedMessage> (OnModelChanged);
            }

            // Determine if sync is running, if so, delay setting IsLoading to false
            var syncManager = ServiceContainer.Resolve <SyncManager> ();

            if (!syncManager.IsRunning)
            {
                IsLoading = false;
            }
            else
            {
                subscriptionSyncFinished = bus.Subscribe <SyncFinishedMessage> (OnSyncFinished);
            }
            OnUpdated();
        }
Exemplo n.º 14
0
        private void OperationTick()
        {
            GroupContainer groupContainer = null;

            try {
                groupContainer = MainQueue.Dequeue();
            } catch (InvalidOperationException e) {
                groupContainer = null;
            }
            if (groupContainer != null)
            {
                ExecuteGroup(groupContainer.Group, groupContainer.Parameters);
            }
        }
Exemplo n.º 15
0
            // Utility
            protected void TryTake(Item item, bool tryToEquip)
            {
                GroupContainer stack = item as GroupContainer;

                if (stack != null)
                {
                    ItemManager.Instance.SendTakeStack(LastCharacter, stack);
                }
                else
                {
                    LastCharacter.Inventory.TakeItem(item, tryToEquip);
                }

                m_item.SetBeingTaken(false, null);
                OnActivationDone();
            }
Exemplo n.º 16
0
        private static GroupContainer GetSampleGroupContainer()
        {
            GroupContainer      groupContainer = new GroupContainer();
            SampleUsersProvider provider       = new SampleUsersProvider();

            Dictionary <string, string> sampleUsers = provider.GetSampleUsers();
            GroupItem groupItem = new GroupItem(new Guid(), "Unassigned");

            foreach (KeyValuePair <string, string> sampleUser in sampleUsers)
            {
                groupContainer.AddUser(groupItem,
                                       new UserItem(Guid.NewGuid(), sampleUser.Key, sampleUser.Value, new List <AssignmentItem>()));
            }

            return(groupContainer);
        }
Exemplo n.º 17
0
        public UIElement GetAuthorPanel()
        {
            var stack = new StackContainer();
            var group = new GroupContainer {
                CaptionHtml = "Autorzy", LabelHeight = "10"
            };

            var authorGrid = GridElement.CreatePopulateGrid(AuthorRows);

            authorGrid.EditValue    = "{AuthorRows}";
            authorGrid.FocusedValue = "{FocusedAuthorRow}";
            authorGrid.OuterWidth   = "80";

            group.Elements.Add(authorGrid);
            stack.Elements.Add(group);
            return(stack);
        }
Exemplo n.º 18
0
        private void AddGroupToQueue(OperationGroup group, Parameters parameters)
        {
            if (group.Credentials != null && group.Credentials.Count > 0)
            {
                var credentials = new Parameters();
                credentials.Add("Credentials", group.Credentials);
                group.AddOperationToStart(typeof(SecurityOperation), credentials);
            }

            var groupContainer = new GroupContainer();

            groupContainer.Group      = group;
            groupContainer.Parameters = parameters;
            lock (SetLock) {
                MainQueue.Enqueue(groupContainer);
                LockEvent.Set();
            }
        }
Exemplo n.º 19
0
        public UIElement GetStackElement()
        {
            checkBuffer();
            if (root == null)
            {
                root = new GroupContainer {
                    CaptionHtml = "Zadanie rekrutacyjne",
                    Height      = "*",
                    Width       = "*"
                };

                root.Elements.Add(new GapElement {
                    Height = "1", Width = "1"
                });
                root.Elements.Add(GetGroupElements());
            }
            return(root);
        }
        public OfficeArtContent(FileInformationBlock fib, VirtualStream tableStream)
        {
            VirtualStreamReader reader = new VirtualStreamReader(tableStream);

            tableStream.Seek(fib.fcDggInfo, System.IO.SeekOrigin.Begin);

            if (fib.lcbDggInfo > 0)
            {
                int maxPosition = (int)(fib.fcDggInfo + fib.lcbDggInfo);

                //read the DrawingGroupData
                this.DrawingGroupData = (DrawingGroup)Record.ReadRecord(reader);

                //read the Drawings
                this.Drawings = new List <OfficeArtWordDrawing>();
                while (reader.BaseStream.Position < maxPosition)
                {
                    OfficeArtWordDrawing drawing = new OfficeArtWordDrawing();
                    drawing.dgglbl    = (DrawingType)reader.ReadByte();
                    drawing.container = (DrawingContainer)Record.ReadRecord(reader);

                    for (int i = 0; i < drawing.container.Children.Count; i++)
                    {
                        Record groupChild = drawing.container.Children[i];
                        if (groupChild.TypeCode == 0xF003)
                        {
                            // the child is a subgroup
                            GroupContainer group = (GroupContainer)drawing.container.Children[i];
                            group.Index = i;
                            drawing.container.Children[i] = group;
                        }
                        else if (groupChild.TypeCode == 0xF004)
                        {
                            // the child is a shape
                            ShapeContainer shape = (ShapeContainer)drawing.container.Children[i];
                            shape.Index = i;
                            drawing.container.Children[i] = shape;
                        }
                    }

                    this.Drawings.Add(drawing);
                }
            }
        }
Exemplo n.º 21
0
        private void DoLoadChildren(StructInstance instance, InstanceTreeNode parent, Stream stream,
            long? offset, int count)
        {
            StructInstance lastChild = instance.LastChild;
            string groupName = GetStringAttribute("group");
            if (groupName != null)
            {
                GroupContainer container = new GroupContainer(parent, groupName);
                parent.AddChild(container);
                parent = container;
            }

            if (count == 0) return;

            StructDef childDef = GetStructAttribute("struct");
            if (childDef == null)
                childDef = _structDef;

            StructInstance childInstance;
            bool followChildren = GetBoolAttribute("followchildren");
            if (offset.HasValue)
            {
                childInstance = new StructInstance(childDef, parent, stream, offset.Value);
            }
            else
            {
                bool firstFollowChildren = followChildren && lastChild != parent;
                childInstance = new StructInstance(childDef, parent, stream, lastChild, firstFollowChildren);
            }
            parent.AddChild(childInstance);
            if (count > 1)
            {
                childInstance.SequenceIndex = 0;
            }

            for (int i = 1; i < count; i++)
            {
                var nextInstance = new StructInstance(childDef, parent, stream, childInstance, followChildren);
                parent.AddChild(nextInstance);
                nextInstance.SequenceIndex = i;
                childInstance = nextInstance;
            }
        }
Exemplo n.º 22
0
        public UIElement GetStackElement()
        {
            checkBuffer();
            if (root == null)
            {
                root = new GroupContainer {
                    CaptionHtml = "Generowana lista spotkań",
                    Height      = "*",
                    Width       = "*"
                };

                root.Elements.Add(GetFilterElements());
                root.Elements.Add(new GapElement {
                    Height = "1", Width = "1"
                });
                root.Elements.Add(GetGroupElements());
            }
            return(root);
        }
Exemplo n.º 23
0
        public UIElement GetSource()
        {
            var labelName = new LabelElement();

            var labelAverage = new LabelElement();

            var stack = new StackContainer();
            var group = new GroupContainer {
                CaptionHtml = "Tytuł grupy", LabelHeight = "10"
            };
            var row    = new RowContainer();
            var rowCmd = new RowContainer();

            //create grid
            IList <GridData> gridData = new List <GridData>();

            Grid.EditValue = "{gridData}";

            //create header
            Login = "******";
            CommitsAverageForDay = GetCommitsAverageForUser(Login);
            //



            var field1 = new FieldElement {
                CaptionHtml = "Pole 1", EditValue = "{Field1}", OuterWidth = "30"
            };
            var command = new CommandElement {
                CaptionHtml = "Pokaż wartości", MethodName = "ShowFieldValue", Width = "20"
            };

            row.Elements.Add(field1);
            rowCmd.Elements.Add(command);

            group.Elements.Add(row);
            group.Elements.Add(rowCmd);
            stack.Elements.Add(group);

            return(stack);
        }
Exemplo n.º 24
0
        private UIElement getUIElement(int i)
        {
            var env   = new EnvironmentExtender();
            var row   = new RowContainer();
            var group = new GroupContainer {
                DataContext = "{Tasks[" + i + "]}",
                CaptionHtml = "{Title}",
                Width       = "350px",
                Height      = "80px"
            };

            var stackRight = new StackContainer {
                LabelWidth = "20",
            };

            var labelAddress2 = new LabelElement {
                CaptionHtml = "{Commit.Description}",
                Width       = "100"
            };

            stackRight.Elements.Add(labelAddress2);

            row.Elements.Add(stackRight);

            if (env.IsHtml)
            {
                stackRight.Class = new[] { UIClass.Tight }
            }
            ;

            group.Elements.Add(row);
            group.Elements.Add(new GapElement {
                Height = "1",
                Width  = "0"
            });

            return(group);
        }
    }
Exemplo n.º 25
0
        private static GroupContainer FromQuery(IModelQuery <TimeEntryModel> query)
        {
            var groups = new GroupContainer();

            try {
                // Find unique time entries and add them to the list
                foreach (var entry in query)
                {
                    if (groups.Contains(entry))
                    {
                        continue;
                    }
                    groups.Add(entry);
                }

                groups.Sort();
            } catch (Exception exc) {
                var log = ServiceContainer.Resolve <Logger> ();
                log.Error(Tag, exc, "Failed to compose recent time entries");
            }
            return(groups);
        }
Exemplo n.º 26
0
        static private void AddCustomHoldInteractions(InteractionActivator activator, ref IInteraction vanillaHold)
        {
            #region quit
            if (_groundInteractions == GroundInteractions.None)
            {
                return;
            }
            #endregion

            Item           item  = activator.GetComponentInParent <Item>();
            GroupContainer stack = item as GroupContainer;
            if (item != null && vanillaHold == null)
            {
                if (_groundInteractions.Value.HasFlag(GroundInteractions.EatAndDrink) && item.IsIngestible())
                {
                    vanillaHold = activator.gameObject.AddComponent <InteractionIngest>();
                }
                else if (_groundInteractions.Value.HasFlag(GroundInteractions.EatAndDrink) && stack != null && stack.FirstItem().IsIngestible())
                {
                    vanillaHold = activator.gameObject.AddComponent <InteractionUnpackAndIngest>();
                }
                else if (_groundInteractions.Value.HasFlag(GroundInteractions.UseBandage) && item.ItemID == "Bandages".ItemID())
                {
                    vanillaHold = activator.gameObject.AddComponent <InteractionUse>();
                }
                else if (_groundInteractions.Value.HasFlag(GroundInteractions.InfuseWeapon) && item is InfuseConsumable)
                {
                    vanillaHold = activator.gameObject.AddComponent <InteractionUse>();
                }
                else if (_groundInteractions.Value.HasFlag(GroundInteractions.SwitchEquipment) && item is Equipment)
                {
                    vanillaHold = activator.gameObject.AddComponent <InteractionSwitchItem>();
                }
                else if (_groundInteractions.Value.HasFlag(GroundInteractions.DeployKit) && item.HasComponent <Deployable>())
                {
                    vanillaHold = activator.gameObject.AddComponent <InteractionDeploy>();
                }
            }
        }
Exemplo n.º 27
0
        private static async Task <GroupContainer> FromQuery(IDataQuery <TimeEntryData> query)
        {
            var groups = new GroupContainer();

            try {
                var entries = await query.QueryAsync().ConfigureAwait(false);

                // Find unique time entries and add them to the list
                foreach (var entry in entries)
                {
                    if (groups.Contains(entry))
                    {
                        continue;
                    }
                    groups.Add(entry);
                }

                groups.Sort();
            } catch (Exception exc) {
                var log = ServiceContainer.Resolve <ILogger> ();
                log.Error(Tag, exc, "Failed to compose recent time entries");
            }
            return(groups);
        }
Exemplo n.º 28
0
        List <Employee> _employeeClipBoard;                //unassigned employees

        public GroupAdmin()
        {
            _groupContainer = DataBaseMockUp.LoadGroups(); // TODO rigtig database
            //_groupContainer = new GroupContainer();
            _taskDescriptionsClipBoard = new List <TaskDescription>();
        }
        protected void SetupGroupItem(GroupContainer groupContainer)
        {
            // Assume read
            groupContainer.unread = false;

            // Count the available contracts
            int available = 0;
            foreach (ContractContainer contractContainer in groupContainer.childContracts)
            {
                if (contractContainer.contract != null)
                {
                    if (contractContainer.contract.ContractState == Contract.State.Offered)
                    {
                        available++;
                    }
                    if (contractContainer.contract.ContractViewed == Contract.Viewed.Unseen)
                    {
                        groupContainer.unread = true;
                    }
                }
            }
            foreach (GroupContainer childContainer in groupContainer.childGroups)
            {
                available += childContainer.availableContracts;
                if (childContainer.unread)
                {
                    groupContainer.unread = true;
                }
            }
            groupContainer.availableContracts = available;

            // Get the main text object
            GameObject textObject = groupContainer.mcListItem.title.gameObject;
            RectTransform textRect = textObject.GetComponent<RectTransform>();

            // Create or find a text object to display the number of contracts
            Transform transform = groupContainer.mcListItem.title.transform.parent.FindChild("AvailableText");
            GameObject availableTextObject = null;
            if (transform != null)
            {
                availableTextObject = transform.gameObject;
            }
            else
            {
                availableTextObject = UnityEngine.Object.Instantiate<GameObject>(groupContainer.mcListItem.title.gameObject);
                availableTextObject.name = "AvailableText";
                availableTextObject.transform.SetParent(groupContainer.mcListItem.title.transform.parent);
                RectTransform availableTextRect = availableTextObject.GetComponent<RectTransform>();
                availableTextRect.anchoredPosition3D = textRect.anchoredPosition3D;
                availableTextRect.sizeDelta = new Vector2(textRect.sizeDelta.x + 4, textRect.sizeDelta.y - 4);
            }

            // Setup the available text
            TMPro.TextMeshProUGUI availableText = availableTextObject.GetComponent<TMPro.TextMeshProUGUI>();
            availableText.alignment = TMPro.TextAlignmentOptions.BottomRight;
            availableText.text = "<color=#" + (groupContainer.availableContracts == 0 ? "CCCCCC" : "8BED8B") + ">Offered: " + groupContainer.availableContracts + "</color>";
            availableText.fontSize = groupContainer.mcListItem.title.fontSize - 3;

            // Setup the group text
            groupContainer.mcListItem.title.text = "<color=#fefa87>" + groupContainer.DisplayName() + "</color>";
            if (groupContainer.unread)
            {
                groupContainer.mcListItem.title.text = "<b>" + groupContainer.mcListItem.title.text + "</b>";
            }
        }
Exemplo n.º 30
0
 internal static void Update_GroupContainer_Activities(GroupContainer groupContainer, ActivityCollection localCollection, ActivityCollection masterCollection)
 {
     localCollection.CollectionContent = masterCollection.CollectionContent;
     if (localCollection.OrderFilterIDList == null)
         localCollection.OrderFilterIDList = new List<string>();
 }
Exemplo n.º 31
0
        private void load(TextureStore textures, Storage storage)
        {
            RelativeSizeAxes = Axes.Both;

            this.storage = storage;

            TeamList ??= new StorageBackedTeamList(storage);

            if (!TeamList.Teams.Any())
            {
                return;
            }

            drawingsConfig = new DrawingsConfigManager(storage);

            InternalChildren = new Drawable[]
            {
                // Main container
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        new Sprite
                        {
                            RelativeSizeAxes = Axes.Both,
                            FillMode         = FillMode.Fill,
                            Texture          = textures.Get(@"Backgrounds/Drawings/background.png")
                        },
                        // Visualiser
                        new VisualiserContainer
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,

                            RelativeSizeAxes = Axes.X,
                            Size             = new Vector2(1, 10),

                            Colour = new Color4(255, 204, 34, 255),

                            Lines = 6
                        },
                        // Groups
                        groupsContainer = new GroupContainer(drawingsConfig.Get <int>(DrawingsConfig.Groups), drawingsConfig.Get <int>(DrawingsConfig.TeamsPerGroup))
                        {
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre,

                            RelativeSizeAxes = Axes.Y,
                            AutoSizeAxes     = Axes.X,

                            Padding = new MarginPadding
                            {
                                Top    = 35f,
                                Bottom = 35f
                            }
                        },
                        // Scrolling teams
                        teamsContainer = new ScrollingTeamContainer
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,

                            RelativeSizeAxes = Axes.X,
                        },
                        // Scrolling team name
                        fullTeamNameText = new TournamentSpriteText
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.TopCentre,

                            Position = new Vector2(0, 45f),

                            Colour = OsuColour.Gray(0.95f),

                            Alpha = 0,

                            Font = OsuFont.Torus.With(weight: FontWeight.Light, size: 42),
                        }
                    }
                },
                // Control panel container
                new ControlPanel
                {
                    new TourneyButton
                    {
                        RelativeSizeAxes = Axes.X,

                        Text   = "Begin random",
                        Action = teamsContainer.StartScrolling,
                    },
                    new TourneyButton
                    {
                        RelativeSizeAxes = Axes.X,

                        Text   = "Stop random",
                        Action = teamsContainer.StopScrolling,
                    },
                    new TourneyButton
                    {
                        RelativeSizeAxes = Axes.X,

                        Text   = "Reload",
                        Action = reloadTeams
                    },
                    new ControlPanel.Spacer(),
                    new TourneyButton
                    {
                        RelativeSizeAxes = Axes.X,

                        Text   = "Reset",
                        Action = () => reset()
                    }
                }
            };

            teamsContainer.OnSelected      += onTeamSelected;
            teamsContainer.OnScrollStarted += () => fullTeamNameText.FadeOut(200);

            reset(true);
        }
Exemplo n.º 32
0
        private void load(TextureStore textures, Storage storage)
        {
            RelativeSizeAxes = Axes.Both;

            this.storage = storage;

            TeamList ??= new StorageBackedTeamList(storage);

            if (!TeamList.Teams.Any())
            {
                LinkFlowContainer links;

                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        Colour           = Color4.Black,
                        RelativeSizeAxes = Axes.Both,
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        Height           = 0.3f,
                    },
                    new WarningBox("No drawings.txt file found. Please create one and restart the client."),
                    links = new LinkFlowContainer
                    {
                        Anchor       = Anchor.Centre,
                        Origin       = Anchor.Centre,
                        Y            = 60,
                        AutoSizeAxes = Axes.Both
                    }
                };

                links.AddLink("Click for details on the file format", "https://osu.ppy.sh/wiki/en/Tournament_Drawings", t => t.Colour = Color4.White);
                return;
            }

            drawingsConfig = new DrawingsConfigManager(storage);

            InternalChildren = new Drawable[]
            {
                // Main container
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        new Sprite
                        {
                            RelativeSizeAxes = Axes.Both,
                            FillMode         = FillMode.Fill,
                            Texture          = textures.Get(@"Backgrounds/Drawings/background.png")
                        },
                        // Visualiser
                        new VisualiserContainer
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,

                            RelativeSizeAxes = Axes.X,
                            Size             = new Vector2(1, 10),

                            Colour = new Color4(255, 204, 34, 255),

                            Lines = 6
                        },
                        // Groups
                        groupsContainer = new GroupContainer(drawingsConfig.Get <int>(DrawingsConfig.Groups), drawingsConfig.Get <int>(DrawingsConfig.TeamsPerGroup))
                        {
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre,

                            RelativeSizeAxes = Axes.Y,
                            AutoSizeAxes     = Axes.X,

                            Padding = new MarginPadding
                            {
                                Top    = 35f,
                                Bottom = 35f
                            }
                        },
                        // Scrolling teams
                        teamsContainer = new ScrollingTeamContainer
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,

                            RelativeSizeAxes = Axes.X,
                        },
                        // Scrolling team name
                        fullTeamNameText = new TournamentSpriteText
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.TopCentre,

                            Position = new Vector2(0, 45f),

                            Colour = OsuColour.Gray(0.95f),

                            Alpha = 0,

                            Font = OsuFont.Torus.With(weight: FontWeight.Light, size: 42),
                        }
                    }
                },
                // Control panel container
                new ControlPanel
                {
                    new TourneyButton
                    {
                        RelativeSizeAxes = Axes.X,

                        Text   = "Begin random",
                        Action = teamsContainer.StartScrolling,
                    },
                    new TourneyButton
                    {
                        RelativeSizeAxes = Axes.X,

                        Text   = "Stop random",
                        Action = teamsContainer.StopScrolling,
                    },
                    new TourneyButton
                    {
                        RelativeSizeAxes = Axes.X,

                        Text   = "Reload",
                        Action = reloadTeams
                    },
                    new ControlPanel.Spacer(),
                    new TourneyButton
                    {
                        RelativeSizeAxes = Axes.X,

                        Text   = "Reset",
                        Action = () => reset()
                    }
                }
            };

            teamsContainer.OnSelected      += onTeamSelected;
            teamsContainer.OnScrollStarted += () => fullTeamNameText.FadeOut(200);

            reset(true);
        }
Exemplo n.º 33
0
 internal static void Update_GroupContainer_LocationCollection(GroupContainer groupContainer, AddressAndLocationCollection localCollection, AddressAndLocationCollection masterCollection)
 {
     if (localCollection == null)
     {
         groupContainer.LocationCollection = AddressAndLocationCollection.CreateDefault();
         localCollection = groupContainer.LocationCollection;
     }
     localCollection.CollectionContent = masterCollection.CollectionContent;
     if (localCollection.OrderFilterIDList == null)
         localCollection.OrderFilterIDList = new List<string>();
 }
 protected void SetupParentGroups(GroupContainer mainGroup)
 {
     for (GroupContainer groupContainer = mainGroup.parent; groupContainer != null; groupContainer = groupContainer.parent)
     {
         SetupGroupItem(groupContainer);
     }
 }
        protected GroupContainer CreateGroupItem(GroupContainer groupContainer, int indent = 0, KSP.UI.UIListItem previous = null)
        {
            MCListItem mcListItem = UnityEngine.Object.Instantiate<MCListItem>(MissionControl.Instance.PrfbMissionListItem);
            mcListItem.container.Data = groupContainer;
            groupContainer.mcListItem = mcListItem;

            // Set up the list item with the group details
            if (groupContainer.agent != null)
            {
                mcListItem.logoSprite.texture = groupContainer.agent.LogoScaled;
            }
            mcListItem.difficulty.gameObject.SetActive(false);

            // Force to the default state
            mcListItem.GetComponent<Image>().sprite = groupUnexpandedInactive;

            // Add the list item to the UI, and add indent
            if (previous == null)
            {
                MissionControl.Instance.scrollListContracts.AddItem(mcListItem.container, true);

                groupContainer.listItemTransform = mcListItem.transform;
                SetIndent(mcListItem, indent);
            }
            else
            {
                InsertIntoList(groupContainer, indent, previous);
            }

            // Create as unexpanded
            if (indent != 0)
            {
                mcListItem.gameObject.SetActive(false);
            }

            // Set the callbacks
            mcListItem.radioButton.onFalseBtn.AddListener(new UnityAction<UIRadioButton, UIRadioButton.CallType, PointerEventData>(OnDeselectGroup));
            mcListItem.radioButton.onTrueBtn.AddListener(new UnityAction<UIRadioButton, UIRadioButton.CallType, PointerEventData>(OnSelectGroup));

            bool hasChildren = false;

            // Add any child groups
            if (groupContainer.group != null)
            {
                foreach (ContractGroup child in ContractGroup.AllGroups.Where(g => g != null && g.parent == groupContainer.group && ContractType.AllValidContractTypes.Any(ct => g.BelongsToGroup(ct))).
                    OrderBy(g => GroupContainer.OrderKey(g)))
                {
                    hasChildren = true;
                    GroupContainer childContainer = new GroupContainer(child);
                    childContainer.parent = groupContainer;
                    groupContainer.childGroups.Add(CreateGroupItem(childContainer, indent + 1));
                }
            }

            // Add contracts
            Container lastContainer = groupContainer;
            foreach (ContractContainer contractContainer in GetContracts(groupContainer).OrderBy(c => c.OrderKey))
            {
                contractContainer.parent = groupContainer;
                groupContainer.childContracts.Add(contractContainer);

                hasChildren = true;
                CreateContractItem(contractContainer, indent + 1, previous != null ? lastContainer.mcListItem.container : null);
                lastContainer = contractContainer;
            }

            // Remove groups with nothing underneath them
            if (!hasChildren)
            {
                MissionControl.Instance.scrollListContracts.RemoveItem(mcListItem.container, true);
            }

            // Get the main text object
            GameObject textObject = mcListItem.title.gameObject;
            RectTransform textRect = textObject.GetComponent<RectTransform>();

            // Make non-static modifications
            SetupGroupItem(groupContainer);

            // Adjust the main text up a little
            textRect.anchoredPosition = new Vector2(textRect.anchoredPosition.x, textRect.anchoredPosition.y + 6);

            return groupContainer;
        }
 protected IEnumerable<ContractContainer> GetContracts(GroupContainer groupContainer)
 {
     if (groupContainer.stockContractType != null)
     {
         foreach (Contract contract in ContractSystem.Instance.Contracts.Where(c => c.GetType() == groupContainer.stockContractType))
         {
             yield return new ContractContainer(contract);
         }
     }
     else
     {
         foreach (ContractType contractType in ContractType.AllValidContractTypes.Where(ct => ct.group == groupContainer.group))
         {
             // Return any configured contracts for the group
             bool any = false;
             foreach (ConfiguredContract contract in ConfiguredContract.CurrentContracts)
             {
                 if (contract.contractType == contractType)
                 {
                     any = true;
                     yield return new ContractContainer(contract);
                 }
             }
             // If there are none, then return the contract type
             if (!any)
             {
                 yield return new ContractContainer(contractType);
             }
         }
     }
 }
        protected void OnContractOffered(Contract c)
        {
            LoggingUtil.LogVerbose(this, "OnContractOffered: " + c.Title);
            if (MissionControl.Instance == null)
            {
                return;
            }

            // Check we're in the right mode
            if (!displayModeAll || MissionControl.Instance.displayMode != MissionControl.DisplayMode.Available)
            {
                if (MissionControl.Instance.displayMode != MissionControl.DisplayMode.Available)
                {
                    MissionControl.Instance.ClearInfoPanel();
                    MissionControl.Instance.panelView.gameObject.SetActive(false);
                    MissionControl.Instance.RebuildContractList();
                }
                else
                {
                    OnClickAvailable(true);
                    OnSelectContract(selectedButton, UIRadioButton.CallType.USER, null);
                }
                return;
            }

            ConfiguredContract cc = c as ConfiguredContract;
            ContractContainer container = null;
            if (cc != null)
            {
                ContractContainer foundMatch = null;

                List<UIListData<KSP.UI.UIListItem>>.Enumerator enumerator = MissionControl.Instance.scrollListContracts.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    KSP.UI.UIListItem item = enumerator.Current.listItem;
                    container = item.Data as ContractContainer;
                    if (container != null)
                    {
                        if (container.contractType == cc.contractType)
                        {
                            // Upgrade the contract type line item to a contract
                            if (container.contract == null)
                            {
                                container.contract = cc;
                                SetupContractItem(container);

                                // Check if the selection was this contract type
                                if (selectedButton != null)
                                {
                                    ContractContainer contractContainer = selectedButton.GetComponent<KSP.UI.UIListItem>().Data as ContractContainer;
                                    if (contractContainer != null && contractContainer == container)
                                    {
                                        OnSelectContract(selectedButton, UIRadioButton.CallType.USER, null);
                                    }
                                }

                                break;
                            }
                            // Keep track of the list item - we'll add immediately after it
                            else
                            {
                                foundMatch = container;
                            }
                        }
                        continue;
                    }
                }

                // Got a match, do an addition
                if (foundMatch != null)
                {
                    container = new ContractContainer(cc);
                    container.parent = foundMatch.parent;
                    container.parent.childContracts.Add(container);
                    CreateContractItem(container, foundMatch.indent, foundMatch.mcListItem.container);

                    // Show/hide based on state of group line
                    container.mcListItem.gameObject.SetActive(container.parent.expanded && container.parent.mcListItem.gameObject.activeSelf);
                }
            }
            else
            {
                List<UIListData<KSP.UI.UIListItem>>.Enumerator enumerator = MissionControl.Instance.scrollListContracts.GetEnumerator();
                Type contractType = c.GetType();
                GroupContainer closestGroup = null;
                ContractContainer lastEntry = null;
                ContractContainer foundMatch = null;
                while (enumerator.MoveNext())
                {
                    KSP.UI.UIListItem item = enumerator.Current.listItem;
                    // Check for a group to use for the position later if we need to add a group
                    GroupContainer groupContainer = item.Data as GroupContainer;
                    if (groupContainer != null)
                    {
                        if (closestGroup == null || string.Compare(groupContainer.DisplayName(), GroupContainer.DisplayName(contractType)) < 0)
                        {
                            closestGroup = groupContainer;
                        }
                    }

                    ContractContainer otherContainer = item.Data as ContractContainer;
                    if (otherContainer != null)
                    {
                        // Track the last entry in case we need to do a group insert
                        if (otherContainer.root == closestGroup)
                        {
                            lastEntry = otherContainer;
                        }

                        if (otherContainer.parent != null && otherContainer.parent.stockContractType == contractType)
                        {
                            foundMatch = otherContainer;
                        }
                    }
                }

                // Add the new item to the end of the grouping
                if (foundMatch != null)
                {
                    container = new ContractContainer(c);
                    container.parent = foundMatch.parent;
                    container.parent.childContracts.Add(container);
                    CreateContractItem(container, foundMatch.indent, foundMatch.mcListItem.container);

                    // Show/hide based on state of group line
                    container.mcListItem.gameObject.SetActive(container.parent.expanded && container.parent.mcListItem.gameObject.activeSelf);
                }
                // Need to create a group if it wasn't found (this will create the contract too
                else
                {
                    GroupContainer groupContainer = new GroupContainer(contractType);
                    CreateGroupItem(groupContainer, 0, lastEntry.mcListItem.container);
                }
            }

            // Update group details
            if (container != null)
            {
                SetupParentGroups(container);
            }
        }
Exemplo n.º 38
0
 private IGrouping <TObject, TGroupKey> GetGroupState(GroupContainer grouping)
 {
     return(new ImmutableGroup <TObject, TGroupKey>(grouping.Key, grouping.List));
 }