public AGSCharacter(string id, Resolver resolver, IOutfit outfit) : base(id, resolver) { _hasRoom = AddComponent<IHasRoom>(); _animationContainer = AddComponent<IAnimationContainer>(); _inObjectTree = AddComponent<IInObjectTree>(); _collider = AddComponent<ICollider>(); _visibleComponent = AddComponent<IVisibleComponent>(); _enabledComponent = AddComponent<IEnabledComponent>(); _customProperties = AddComponent<ICustomPropertiesComponent>(); _drawableInfo = AddComponent<IDrawableInfo>(); _hotspotComponent = AddComponent<IHotspotComponent>(); _shaderComponent = AddComponent<IShaderComponent>(); _transformComponent = AddComponent<ITranslateComponent>(); _imageComponent = AddComponent<IImageComponent>(); _scaleComponent = AddComponent<IScaleComponent>(); _rotateComponent = AddComponent<IRotateComponent>(); _pixelPerfectComponent = AddComponent<IPixelPerfectComponent>(); _faceDirectionBehavior = AddComponent<IFaceDirectionBehavior>(); _hasOutfit = AddComponent<IHasOutfit>(); _hasInventory = AddComponent<IHasInventory>(); _followBehavior = AddComponent<IFollowBehavior>(); beforeInitComponents(resolver, outfit); InitComponents(); afterInitComponents(resolver, outfit); }
public AGSCharacter(string id, Resolver resolver, IOutfit outfit) : base(id, resolver) { _hasRoom = AddComponent <IHasRoom>(); _animationContainer = AddComponent <IAnimationContainer>(); _inObjectTree = AddComponent <IInObjectTree>(); _collider = AddComponent <ICollider>(); _visibleComponent = AddComponent <IVisibleComponent>(); _enabledComponent = AddComponent <IEnabledComponent>(); _customProperties = AddComponent <ICustomPropertiesComponent>(); _drawableInfo = AddComponent <IDrawableInfo>(); _hotspotComponent = AddComponent <IHotspotComponent>(); _shaderComponent = AddComponent <IShaderComponent>(); _translateComponent = AddComponent <ITranslateComponent>(); _imageComponent = AddComponent <IImageComponent>(); _scaleComponent = AddComponent <IScaleComponent>(); _rotateComponent = AddComponent <IRotateComponent>(); _pixelPerfectComponent = AddComponent <IPixelPerfectComponent>(); _faceDirectionBehavior = AddComponent <IFaceDirectionBehavior>(); _hasOutfit = AddComponent <IHasOutfit>(); _hasInventory = AddComponent <IHasInventory>(); _followBehavior = AddComponent <IFollowBehavior>(); _modelMatrixComponent = AddComponent <IModelMatrixComponent>(); beforeInitComponents(resolver, outfit); InitComponents(); afterInitComponents(resolver, outfit); }
public static void SendInventoryTo(IHasInventory HasInventory, int Receiver) { var Ids = new Items.ID[HasInventory.Inventory.Contents.Length]; var Counts = new int[HasInventory.Inventory.Contents.Length]; int Index = 0; while (Index < HasInventory.Inventory.Contents.Length) { Items.Instance Item = HasInventory.Inventory.Contents[Index]; if (Item is null) { Ids[Index] = Items.ID.NONE; Counts[Index] = 0; Index += 1; continue; } Ids[Index] = Item.Id; Counts[Index] = Item.Count; Index += 1; } Self.RpcUnreliableId(Receiver, nameof(ReceiveInventory), HasInventory.Name, Ids, Counts); }
public ItemTransfer(IHasInventory source, IHasInventory destination, ItemType itemType, decimal quantity) { Source = source; Destination = destination; Type = itemType; Quantity = quantity; }
public Inventory(IHasInventory parent, EngineSettings settings) { Settings = settings; Parent = parent; Construct (); }
public Inventory(IHasInventory parent, EngineSettings settings) { Settings = settings; Parent = parent; Construct(); }
public Inventory(IHasInventory parent, DemandList demands, EngineSettings settings) { Parent = parent; Settings = settings; Demands = demands; Construct (); }
public Inventory(IHasInventory parent, DemandList demands, EngineSettings settings) { Parent = parent; Settings = settings; Demands = demands; Construct(); }
public static void TransferFromTo(IHasInventory From, int FromSlot, IHasInventory ToPath, int ToSlot, Items.IntentCount CountMode) { if (Net.Work.IsNetworkServer()) { Self.ReceiveTransferFromTo(From.GetPath(), FromSlot, ToPath.GetPath(), ToSlot, CountMode); } else { Self.RpcId(Net.ServerId, nameof(ReceiveTransferFromTo), From.GetPath(), FromSlot, ToPath.GetPath(), ToSlot, CountMode); } }
public InventoryIcon InstantiateIcon(int SlotArg, IHasInventory SourceArg) { var Icon = (InventoryIcon)InventoryIconScene.Instance(); Icon.ParentMenu = this; Icon.Slot = SlotArg; Icon.Source = SourceArg; Icon.Case = InventoryIcon.UsageCase.MENU; return(Icon); }
public static void BuildInteractInventory(IHasInventory Other) { Reset(); var Inv = (InventoryMenu)InventoryMenu.Instance(); Inv.Other = Other; Contents = Inv; MenuRoot.AddChild(Contents); ShadedBackground.Show(); IngameMenuOpen = true; }
public InventoryComponent(IHasInventory OwnerArg, int SlotCountArg, bool HiddenLast = false) { Contents = new Items.Instance[SlotCountArg]; Owner = OwnerArg; if (HiddenLast) { SlotCount = SlotCountArg - 1; } else { SlotCount = SlotCountArg; } }
private string LookAtIn(string thingId, IHasInventory container) { string response; GameObject thing = container.Locate(thingId); if (thing != null) { response = thing.FullDescription; } else { response = string.Format("I cannot find the {0}", thingId); } return(response); }
public static void SendInventory(IHasInventory HasInventory) { if (!Net.Work.IsNetworkServer()) { throw new Exception($"Cannot run {nameof(SendInventory)} on client"); } foreach (int Receiver in Net.Players.Keys) { if (Receiver == Net.Work.GetNetworkUniqueId()) { continue; } Net.Players[Receiver].Plr.MatchSome( (Plr) => { var EntityChunk = World.GetChunkTuple(HasInventory.Translation); if (World.ChunkWithinDistanceFrom(EntityChunk, World.ChunkRenderDistances[Receiver], Plr.Translation)) { var Ids = new Items.ID[HasInventory.Inventory.Contents.Length]; var Counts = new int[HasInventory.Inventory.Contents.Length]; int Index = 0; while (Index < HasInventory.Inventory.Contents.Length) { Items.Instance Item = HasInventory.Inventory.Contents[Index]; if (Item is null) { Ids[Index] = Items.ID.NONE; Counts[Index] = 0; Index += 1; continue; } Ids[Index] = Item.Id; Counts[Index] = Item.Count; Index += 1; } Self.RpcUnreliableId(Receiver, nameof(ReceiveInventory), HasInventory.Name, Ids, Counts); } } ); } }
public void Transfer(ItemType itemType, decimal amount, IHasInventory target) { throw new NotImplementedException(); /*if (Parent == null) * throw new Exception ("Parent property is null"); * * if (Settings.IsVerbose) { * Console.WriteDebugLine ("Executing transfer between inventories."); * Console.WriteDebugLine (" Source type: " + Parent.GetType().Name); * Console.WriteDebugLine (" Target type: " + target.GetType().Name); * Console.WriteDebugLine (" Item type: " + itemType); * Console.WriteDebugLine (" Amount: " + amount); * } * * target.Inventory.Items [itemType] += amount; * Items [itemType] -= amount;*/ }
// Expand with index public bool Pass(Entity toThat, int inventoryID = 0) { // Must be `close` to pass if (!InRange(toThat, 1)) { return(false); } // Can only pass to other carriers IHasInventory passee = toThat as IHasInventory; if (passee == null) { return(false); } // Hub case, try "sell" all, always succeeds Hub passeeHub = toThat as Hub; if (passeeHub != null) { for (int i = 0; i < _inventory.Count; i++) { if (passeeHub.Recieve(_inventory[i])) { _inventory.RemoveAt(i); i--; } } return(true); } // We must have an item to pass if (_inventory.Count > inventoryID && passee.Recieve(_inventory[inventoryID])) { //BroadcastInteract(); // TODO: REMOVE _inventory.RemoveAt(0); return(true); } //Status = EntityStatus.Idle; // TODO: REMOVE return(false); }
public FromData(IHasInventory SourceArg, Items.IntentCount CountModeArg) { Source = SourceArg; CountMode = CountModeArg; }
public SourceData(IHasInventory SourceArg, DragMode ModeArg) { Source = SourceArg; Mode = ModeArg; }
public InventoryComponent(IHasInventory OwnerArg, int SlotCountArg) { Owner = OwnerArg; Contents = new Items.Instance[SlotCountArg]; }
public void AddTransfer(IHasInventory source, IHasInventory destination, ItemType itemType, decimal quantity) { Transfers.Add (new ItemTransfer(source, destination, itemType, quantity)); }
public void AddTransfer(IHasInventory source, IHasInventory destination, ItemType itemType, decimal quantity) { Transfers.Add(new ItemTransfer(source, destination, itemType, quantity)); }