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);            
        }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
    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);
    }
Exemplo n.º 4
0
 public ItemTransfer(IHasInventory source, IHasInventory destination, ItemType itemType, decimal quantity)
 {
     Source      = source;
     Destination = destination;
     Type        = itemType;
     Quantity    = quantity;
 }
Exemplo n.º 5
0
 public ItemTransfer(IHasInventory source, IHasInventory destination, ItemType itemType, decimal quantity)
 {
     Source = source;
     Destination = destination;
     Type = itemType;
     Quantity = quantity;
 }
Exemplo n.º 6
0
        public Inventory(IHasInventory parent, EngineSettings settings)
        {
            Settings = settings;

            Parent = parent;

            Construct ();
        }
Exemplo n.º 7
0
        public Inventory(IHasInventory parent, EngineSettings settings)
        {
            Settings = settings;

            Parent = parent;

            Construct();
        }
Exemplo n.º 8
0
        public Inventory(IHasInventory parent, DemandList demands, EngineSettings settings)
        {
            Parent = parent;

            Settings = settings;

            Demands = demands;

            Construct ();
        }
Exemplo n.º 9
0
        public Inventory(IHasInventory parent, DemandList demands, EngineSettings settings)
        {
            Parent = parent;

            Settings = settings;

            Demands = demands;

            Construct();
        }
Exemplo n.º 10
0
 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);
     }
 }
Exemplo n.º 11
0
    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);
    }
Exemplo n.º 12
0
    public static void BuildInteractInventory(IHasInventory Other)
    {
        Reset();

        var Inv = (InventoryMenu)InventoryMenu.Instance();

        Inv.Other = Other;
        Contents  = Inv;
        MenuRoot.AddChild(Contents);
        ShadedBackground.Show();
        IngameMenuOpen = true;
    }
Exemplo n.º 13
0
    public InventoryComponent(IHasInventory OwnerArg, int SlotCountArg, bool HiddenLast = false)
    {
        Contents = new Items.Instance[SlotCountArg];

        Owner = OwnerArg;

        if (HiddenLast)
        {
            SlotCount = SlotCountArg - 1;
        }
        else
        {
            SlotCount = SlotCountArg;
        }
    }
Exemplo n.º 14
0
        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);
        }
Exemplo n.º 15
0
    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);
                }
            }
                );
        }
    }
Exemplo n.º 16
0
        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;*/
        }
Exemplo n.º 17
0
        // 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);
        }
Exemplo n.º 18
0
 public FromData(IHasInventory SourceArg, Items.IntentCount CountModeArg)
 {
     Source    = SourceArg;
     CountMode = CountModeArg;
 }
Exemplo n.º 19
0
 public SourceData(IHasInventory SourceArg, DragMode ModeArg)
 {
     Source = SourceArg;
     Mode   = ModeArg;
 }
Exemplo n.º 20
0
 public InventoryComponent(IHasInventory OwnerArg, int SlotCountArg)
 {
     Owner    = OwnerArg;
     Contents = new Items.Instance[SlotCountArg];
 }
Exemplo n.º 21
0
 public void AddTransfer(IHasInventory source, IHasInventory destination, ItemType itemType, decimal quantity)
 {
     Transfers.Add (new ItemTransfer(source, destination, itemType, quantity));
 }
Exemplo n.º 22
0
 public void AddTransfer(IHasInventory source, IHasInventory destination, ItemType itemType, decimal quantity)
 {
     Transfers.Add(new ItemTransfer(source, destination, itemType, quantity));
 }