public bObjective(Objective Item) { this.Item = Item; }
public override void OnUpdate() { WorldSide localSide = World_AIW2.Instance.GetLocalSide(); if (localSide == null) { return; } ArcenUI_ButtonSet elementAsType = (ArcenUI_ButtonSet)Element; //Window_InGameObjectivesWindow windowController = (Window_InGameObjectivesWindow)Element.Window.Controller; Instance.UpdatesSinceLastRefresh++; if (Instance.UpdatesSinceLastRefresh >= 5) { Instance.UpdatesSinceLastRefresh = 0; List <Objective> objectives = new List <Objective>(); for (ObjectiveType type = ObjectiveType.None + 1; type < ObjectiveType.Length; type++) { Objective objective = new Objective(type); objective.ComputeCurrentState(); if (objective.State == ObjectiveState.NotApplicable) { continue; } objectives.Add(objective); } bool detectedChange = objectives.Count != Instance.LastComputedObjectives.Count; if (!detectedChange) { for (int i = 0; i < objectives.Count; i++) { Objective newItem = objectives[i]; Objective oldItem = Instance.LastComputedObjectives[i]; if (newItem.GetMatches(oldItem)) { continue; } detectedChange = true; break; } } if (detectedChange) { Instance.LastComputedObjectives = objectives; elementAsType.ClearButtons(); for (int y = 0; y < Instance.LastComputedObjectives.Count; y++) { Objective item = Instance.LastComputedObjectives[y]; bObjective newButtonController = new bObjective(item); Vector2 offset; offset.x = 0; offset.y = y * elementAsType.ButtonHeight; Vector2 size; size.x = elementAsType.ButtonWidth; size.y = elementAsType.ButtonHeight; elementAsType.AddButton(newButtonController, size, offset); } elementAsType.ActuallyPutItemsBackInPoolThatAreStillCleared(); } } }