Example #1
0
 //NPC Related
 public void NPCShopResponse(Client c, PacketReader packet)
 {
     try
     {
         c.npcShop = new NPCShop();
         NPCShop shop = c.npcShop;
         packet.ReadInt();
         packet.ReadInt();
         packet.Read();
         short itemCount = packet.ReadShort();
         int   num       = 1;
         while (itemCount > num)
         {
             int itemID = packet.ReadInt();
             int price  = packet.ReadInt();
             shop.addItem(itemID, price);
             packet.Skip(99);
             num++;
         }
     }
     catch
     {
         c.updateLog("Error Code: xxxx");
     }
 }
Example #2
0
        void OpenShop(NPCShop shop)
        {
            ShopWindow w = new ShopWindow(shop, player);
            Window     p = this.GetParentWindow();

            if (p != null)
            {
                w.X = p.X;
                w.Y = p.Y;
                p.Close();
            }
            WM.Add(w);
            w.Visible = true;
        }
    private void Start()
    {
        anim = GetComponent <Animator>();
        if (!signInformation)
        {
            npcStatus = this.transform.parent.GetComponent <NPCStatus>();
            npcShop   = this.transform.parent.GetComponent <NPCShop>();

            if (npcStatus)
            {
                // add on click to place
                EventTrigger.Entry entry = new EventTrigger.Entry();
                entry.eventID = EventTriggerType.PointerDown;
                entry.callback.AddListener((eventData) => {
                    Debug.Log("Start Talk");
                    npcStatus.StartTalk();
                });
                btnTalk.GetComponent <EventTrigger>().triggers.Add(entry);
            }

            if (npcShop)
            {
                // add on click to place
                EventTrigger.Entry entry = new EventTrigger.Entry();
                entry.eventID = EventTriggerType.PointerDown;
                entry.callback.AddListener((eventData) => {
                    Debug.Log("Start Shop");
                    npcShop.StartShop();
                });
                btnShop.GetComponent <EventTrigger>().triggers.Add(entry);
            }
        }
        else
        {
            sign = this.transform.parent.GetComponent <signControl>();
            EventTrigger.Entry entry = new EventTrigger.Entry();
            entry.eventID = EventTriggerType.PointerDown;
            entry.callback.AddListener((eventData) => {
                sign.ShowInformation();
            });
            btnShop.GetComponent <EventTrigger>().triggers.Add(entry);
        }
    }
Example #4
0
        public ShopWindow(NPCShop shop, GameObject.MapEntities.Actors.Player Player)
        {
            this.Width        = 360;
            this.Height       = 420;
            this.shop         = shop;
            this.WM           = Main.CurrentScene.WindowManager;
            this._basket      = new List <Tuple <GameObject.Item, int> >();
            this._basketslots = new ItemSlot[8];
            this.Player       = Player;
            SetupWares();
            SetupBasket();

            GUI.Controls.Button BuyButton = new GUI.Controls.Button("Purchase");
            BuyButton.Width    = 150;
            BuyButton.Height   = 32;
            BuyButton.X        = 3;
            BuyButton.Y        = (ShopHeight + 1) * _basketslots[0].Height + 30 + 16 + TotalLabel.Height + 5;
            BuyButton.OnClick += new ClickEventHandler((sender, m) => Buy());
            AddControl(BuyButton);
            //#TODO: sell menu - BuysAnything as toggleable option, default on, if on - items on the buying list have custom (higher) price
        }
Example #5
0
 public OpenShop()
 {
     this.Shop = new NPCShop();
 }
Example #6
0
 public NPCShopDlg(NPCShop shop)
 {
     _shop = shop;
 }
Example #7
0
 void Awake()
 {
     instance = this;
 }
Example #8
0
 void Awake()
 {
     instance = this;
 }