private bool onEquipmentEquipped(InventoryPenguinAnimEvents.EquipmentEquipped evt) { EquipmentCategoryDefinitionContentKey categoryForEquipment = getCategoryForEquipment(evt.DefinitionId); CoroutineRunner.Start(loadCategoryDefinition(categoryForEquipment), this, "LoadCategoryDefinition"); return(false); }
private EquipmentCategoryDefinitionContentKey getCategoryForEquipment(int definitionId) { EquipmentCategoryDefinitionContentKey result = null; Dictionary <int, TemplateDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >(); if (dictionary.ContainsKey(definitionId)) { result = dictionary[definitionId].CategoryKey; } else { Log.LogErrorFormatted(this, "Unable to find template definition with id {0}. No equipment category definition found.", definitionId); } return(result); }
private IEnumerator loadCategoryDefinition(EquipmentCategoryDefinitionContentKey categoryKey) { AssetRequest <EquipmentCategoryDefinition> equipmentCategoryDefinitionAssetRequest = null; try { equipmentCategoryDefinitionAssetRequest = Content.LoadAsync(categoryKey); } catch (Exception) { Log.LogErrorFormatted(this, "Could not load category definition {0}.", categoryKey); } if (equipmentCategoryDefinitionAssetRequest != null) { yield return(equipmentCategoryDefinitionAssetRequest); string animTrigger = equipmentCategoryDefinitionAssetRequest.Asset.EquipAnimationTrigger; penguinAnimator.SetTrigger(animTrigger); } }
private void createCategoryButton(EquipmentCategoryDefinitionContentKey categoryDataKey, bool isDisabled = false, string categoryToSelect = "") { GameObject gameObject = Object.Instantiate(categoryButtonPrefab); gameObject.transform.SetParent(base.transform, worldPositionStays: false); CategoryButton component = gameObject.GetComponent <CategoryButton>(); component.Init(categoryDataKey, eventProxy); categoryButtons.Add(categoryDataKey.Key, component); SetCategoryButtonDisabledState(categoryDataKey.Key, isDisabled); if (!string.IsNullOrEmpty(categoryToSelect) && categoryDataKey.Key == categoryToSelect) { gameObject.GetComponent <TintToggleGroupButton>().OnClick(); categoryToSelectButtonIndex = categoryButtons.Count; } else { gameObject.GetComponent <TintToggleGroupButton>().SetTint(on: false); } }
public void Init(EquipmentCategoryDefinitionContentKey categoryDefinitionKey, CategoryManagerEventProxy eventProxy) { this.categoryDefinitionKey = categoryDefinitionKey; this.eventProxy = eventProxy; CoroutineRunner.Start(loadCategoryDefinition(), this, "setupModelRenderer"); }