/// <summary> Called when the data provider is selected </summary> public override void NfoFieldFocus(plyDataObject data, EditorWindow ed) { // make sure the Component that handles the Rewards is registered to be added to DiaQ EdGlobal.RemoveAutoComponent("DiaQ", typeof(plyRPGDiaQRewardHandler).AssemblyQualifiedName); // make sure old one is not present as it causes problems EdGlobal.RegisterAutoComponent("DiaQ", typeof(InventoryProDiaQRewardHandler).AssemblyQualifiedName); _selected = 0; int.TryParse(data.nfo[0], out _selected); if (_attribsAsset == null) { if (_dataAsset == null) { _dataAsset = EdGlobal.GetDataAsset(); } _attribsAsset = (ActorAttributesAsset)_dataAsset.GetAsset <ActorAttributesAsset>(); if (_attribsAsset == null) { _attribsAsset = (ActorAttributesAsset)EdGlobal.LoadOrCreateAsset <ActorAttributesAsset>(plyEdUtil.DATA_PATH_SYSTEM + "attributes.asset", null); } } if (_itemsAsset == null) { if (_dataAsset == null) { _dataAsset = EdGlobal.GetDataAsset(); } _itemsAsset = (ItemsAsset)_dataAsset.GetAsset <ItemsAsset>(); if (_itemsAsset == null) { _itemsAsset = (ItemsAsset)EdGlobal.LoadOrCreateAsset <ItemsAsset>(plyEdUtil.DATA_PATH_SYSTEM + "items.asset", null); } _itemsAsset.UpdateItemCache(); } _selectedIdent = -1; _attribNames = new string[_attribsAsset.attributes.Count]; for (int i = 0; i < _attribsAsset.attributes.Count; i++) { _attribNames[i] = _attribsAsset.attributes[i].def.screenName; if (_selected == 1 && _selectedIdent < 0) { if (data.nfo[1].Equals(_attribsAsset.attributes[i].id.ToString())) { _selectedIdent = i; data.nfo[2] = _attribsAsset.attributes[_selectedIdent].ToString(); // update cached name just in case it has changed GUI.changed = true; } } } }
/// <summary> Called when the data provider is selected </summary> public override void NfoFieldFocus(plyDataObject data, EditorWindow ed) { // make sure the Component that handles the Rewards is registered to be added to DiaQ EdGlobal.RegisterAutoComponent("DiaQ", "plyRPGDiaQRewardHandler"); selected = 0; int.TryParse(data.nfo[0], out selected); if (attribsAsset == null) { if (dataAsset == null) dataAsset = EdGlobal.GetDataAsset(); attribsAsset = (ActorAttributesAsset)dataAsset.GetAsset<ActorAttributesAsset>(); if (attribsAsset == null) attribsAsset = (ActorAttributesAsset)EdGlobal.LoadOrCreateAsset<ActorAttributesAsset>(EdGlobal.DATA_PATH_SYSTEM + "attributes.asset", null); } if (itemsAsset == null) { if (dataAsset == null) dataAsset = EdGlobal.GetDataAsset(); itemsAsset = (ItemsAsset)dataAsset.GetAsset<ItemsAsset>(); if (itemsAsset == null) itemsAsset = (ItemsAsset)EdGlobal.LoadOrCreateAsset<ItemsAsset>(EdGlobal.DATA_PATH_SYSTEM + "items.asset", null); itemsAsset.UpdateItemCache(); } selectedIdent = -1; attribNames = new string[attribsAsset.attributes.Count]; for (int i = 0; i < attribsAsset.attributes.Count; i++) { attribNames[i] = attribsAsset.attributes[i].def.screenName; if (selected == 1 && selectedIdent < 0) { if (data.nfo[1].Equals(attribsAsset.attributes[i].id.ToString())) { selectedIdent = i; data.nfo[2] = attribsAsset.attributes[selectedIdent].def.screenName; // update cached name just in case it has changed GUI.changed = true; } } } if (data.nfo[0] == "2") { if (null == itemsAsset.GetDefinition(new UniqueID(data.nfo[1]))) { data.nfo[1] = ""; data.nfo[2] = ""; GUI.changed = true; } } }
/// <summary> Called when the data provider is selected </summary> public override void NfoFieldFocus(plyDataObject data, EditorWindow ed) { // make sure the Component that handles the Rewards is registered to be added to DiaQ EdGlobal.RemoveAutoComponent("DiaQ", typeof(plyRPGDiaQRewardHandler).AssemblyQualifiedName); // make sure old one is not present as it causes problems EdGlobal.RegisterAutoComponent("DiaQ", typeof(InventoryProDiaQRewardHandler).AssemblyQualifiedName); selected = 0; int.TryParse(data.nfo[0], out selected); if (attribsAsset == null) { if (dataAsset == null) dataAsset = EdGlobal.GetDataAsset(); attribsAsset = (ActorAttributesAsset)dataAsset.GetAsset<ActorAttributesAsset>(); if (attribsAsset == null) attribsAsset = (ActorAttributesAsset)EdGlobal.LoadOrCreateAsset<ActorAttributesAsset>(plyEdUtil.DATA_PATH_SYSTEM + "attributes.asset", null); } if (itemsAsset == null) { if (dataAsset == null) dataAsset = EdGlobal.GetDataAsset(); itemsAsset = (ItemsAsset)dataAsset.GetAsset<ItemsAsset>(); if (itemsAsset == null) itemsAsset = (ItemsAsset)EdGlobal.LoadOrCreateAsset<ItemsAsset>(plyEdUtil.DATA_PATH_SYSTEM + "items.asset", null); itemsAsset.UpdateItemCache(); } selectedIdent = -1; attribNames = new string[attribsAsset.attributes.Count]; for (int i = 0; i < attribsAsset.attributes.Count; i++) { attribNames[i] = attribsAsset.attributes[i].def.screenName; if (selected == 1 && selectedIdent < 0) { if (data.nfo[1].Equals(attribsAsset.attributes[i].id.ToString())) { selectedIdent = i; data.nfo[2] = attribsAsset.attributes[selectedIdent].ToString(); // update cached name just in case it has changed GUI.changed = true; } } } }