public void Refresh() { this.ClearItems(); if (this.mTargetUnit == null) { this.mTargetUnit = DataSource.FindDataOfClass <UnitData>(((Component)this).get_gameObject(), (UnitData)null); } if (this.mTargetUnit == null) { return; } this.mOriginalJobID = this.mTargetUnit.CurrentJob.JobID; for (int index = 0; index < this.mTargetUnit.Jobs.Length; ++index) { if (this.mTargetUnit.Jobs[index].IsActivated) { UnitJobDropdown.JobPulldownItem jobPulldownItem = this.AddItem(this.mTargetUnit.Jobs[index].Name, index) as UnitJobDropdown.JobPulldownItem; if (Object.op_Inequality((Object)jobPulldownItem.JobIcon, (Object)null)) { string name = AssetPath.JobIconSmall(this.mTargetUnit.Jobs[index].Param); if (!string.IsNullOrEmpty(name)) { jobPulldownItem.JobIcon.set_texture((Texture)AssetManager.Load <Texture2D>(name)); } } if (index == this.mTargetUnit.JobIndex) { this.Selection = this.ItemCount - 1; } } } }
protected override void UpdateSelection() { if (!Object.op_Inequality((Object)this.JobIcon, (Object)null)) { return; } UnitJobDropdown.JobPulldownItem itemAt = this.GetItemAt(this.Selection) as UnitJobDropdown.JobPulldownItem; if (!Object.op_Inequality((Object)itemAt, (Object)null) || !Object.op_Inequality((Object)itemAt.JobIcon, (Object)null)) { return; } this.JobIcon.set_texture(itemAt.JobIcon.get_texture()); }
protected override Pulldown.PulldownItem SetupPulldownItem(GameObject itemObject) { UnitJobDropdown.JobPulldownItem jobPulldownItem = (UnitJobDropdown.JobPulldownItem)itemObject.AddComponent <UnitJobDropdown.JobPulldownItem>(); jobPulldownItem.JobIcon = this.ItemJobIcon; return((Pulldown.PulldownItem)jobPulldownItem); }