//[ServerCallback] public void OnTriggerUsed(Character character, TriggerEventData eventData) { if (!PhotonNetwork.LocalPlayer.IsMasterClient) { return; } var bridge = character.GetComponent <PUN2ActionsBridge>(); if (character is Player && bridge != null) { var added = bridge.inventoryPlayer.itemCollectionGroup.Add(itemInstance, amount); if (added.error != null) { // TODO: Notify client why pickup failed DevdogLogger.LogError($"[PUN2][Interaction] PUN2ItemInstancePickup.OnTriggerUsed: {added.error}", this); } else { // Action went succesful, destroy pickup source //NetworkServer.Destroy(gameObject); //PhotonNetwork.Destroy(gameObject); //GameObject.Destroy(gameObject); bridge.photonView.RPC(nameof(bridge.Cmd_RequestUnUseTrigger), PhotonNetwork.MasterClient, this.photonView.ViewID); PhotonNetwork.Destroy(gameObject); } } }
//[ServerCallback] public void OnTriggerUsed(Character character, TriggerEventData eventData) { if (!PhotonNetwork.LocalPlayer.IsMasterClient) { return; } var bridge = character.GetComponent <PUN2ActionsBridge>(); if (character is Player && bridge != null) { var inst = ItemFactory.CreateInstance(itemDefinition, System.Guid.NewGuid()); var added = bridge.inventoryPlayer.itemCollectionGroup.Add(inst, amount); if (added.error != null) { // Something went wrong, remove item from registry to avoid cluttering it with un-used items. ServerItemRegistry.UnRegister(inst.ID); ItemRegistry.UnRegister(inst.ID); // TODO: Notify client why pickup failed DevdogLogger.LogError($"[PUN2][Interaction] PUN2ItemPickup.OnTriggerUsed: {added.error}", this); } else { // Action went succesful, destroy pickup source //NetworkServer.Destroy(gameObject); //PhotonNetwork.Destroy(gameObject); //GameObject.Destroy(gameObject); bridge.photonView.RPC(nameof(bridge.Cmd_RequestUnUseTrigger), PhotonNetwork.MasterClient, this.photonView.ViewID); PhotonNetwork.Destroy(gameObject); } } }
public QuestsContainer GetQuestStates(ILocalIdentifier localIdentifier) { Assert.IsNotNull(localIdentifier, "Local identifier is null. Quest (most likely) doesn't exist in current database."); if (questStates.ContainsKey(localIdentifier) == false) { DevdogLogger.LogError("No quest states found for localIdentifier: " + localIdentifier.ToString()); return(null); } return(questStates[localIdentifier]); }
public virtual string GetStatusMessage() { try { return(string.Format(statusMessage.message, progress, progressNormalized, progressCap)); } catch (Exception e) { DevdogLogger.LogError("Couldn't format quest #" + owner.ID + " status message with error: " + e.Message); } return(""); }
static ObjectPickerUtility() { _allEditorTypes = ReflectionUtility.GetAllClassesWithAttribute(typeof(CustomObjectPickerAttribute), false); foreach (var type in _allEditorTypes) { if (typeof(ObjectPickerBaseEditor).IsAssignableFrom(type) == false) { DevdogLogger.LogError("Class " + type.Name + " has the " + typeof(CustomObjectPickerAttribute).Name + " attribute, but doesn't inherit from " + typeof(ObjectPickerBaseEditor).Name); } } _allEditorTypes = _allEditorTypes.OrderByDescending(o => ((CustomObjectPickerAttribute)o.GetCustomAttributes(typeof(CustomObjectPickerAttribute), true).First()).priority).ToArray(); foreach (var type in _allEditorTypes) { _allEditorTypeAttributes[type] = (CustomObjectPickerAttribute)type.GetCustomAttributes(typeof(CustomObjectPickerAttribute), true).First(); } }
protected void Start() { var col = GetComponent <ItemCollectionBase>(); if (col == null) { DevdogLogger.LogError("CollectionPopulator can only be used on a collection.", transform); return; } if (useForceSet) { for (uint i = 0; i < _items.Length; i++) { col.SetItem(i, _items[i], true); } } else { col.AddItems(_items); } }
public virtual void UpdateEquippableSlots() { equippableSlots = new EquippableSlot[items.Length]; for (int i = 0; i < items.Length; i++) { var c = items[i] as UnityEngine.Component; if (c != null) { equippableSlots[i] = c.gameObject.GetComponent <EquippableSlot>(); Assert.IsNotNull(equippableSlots[i], "CharacterUI manually defined collection contains gameObject without InventoryEquippableField component."); if (equippableSlots[i].equipmentTypes.Any(o => o == null)) { DevdogLogger.LogError("CharacterUI's equipTypes contains null (empty) field.", equippableSlots[i].gameObject); } } } if (equippableSlots.Any(o => o == null)) { DevdogLogger.LogError("This characterUI has an empty reference in the equip slot fields (EquippableFields has empty row)", gameObject); } }
public override void OnExecute(IDialogueOwner dialogueOwner) { waitTime = 0; // Reset wait time incase the node is being replayed. if (_timerHelper == null) { _timerHelper = TimerUtility.GetTimer(); } if (audioInfo.audioClip.val != null) { waitTime += audioInfo.audioClip.val.length; } else { DevdogLogger.LogError("[WaitForAudioNode] - Audio clip is missing from node: " + index + ". Dialogue: " + dialogueOwner.dialogue.name + "."); } waitTime += additionalWaitTime; _timerHelper.StartTimer(waitTime, null, OnTimerEnded); // Finish(true); // Finish once time is completed. }
public void Error(MultiLangString message, bool abort) { DevdogLogger.LogError("Error on node with message: " + message.message); }