Example #1
0
        private void MailLockedItem(S.MailLockedItem p)
        {
            InventoryDialog inventory = GameScene.Scene.InventoryDialog;
            MirItemCell     cell      = inventory.GetCell(p.UniqueID);

            if (cell != null)
            {
                cell.Locked = p.Locked;
            }
        }
    public void Reload(int playerID = 0)
    {
        mysql   = FindObjectOfType <Mysql>();
        players = mysql.GetPlayers();

        if (playerID == 0)
        {
            LoadPlayerDropdown(players);
        }

        if (playerID == 0)
        {
            playerID = players[0].id;
        }

        player_id = playerID;

        InventoryDialog inventoryDialogScript = inventoryDialog.GetComponent <InventoryDialog>();
        Button          addButton             = transform.Find("addButton").GetComponent <Button>();

        addButton.onClick.RemoveAllListeners();
        addButton.onClick.AddListener(() => inventoryDialogScript.AddInventory(player_id));

        List <SerializableObjects.InventorySlot> slots = mysql.ReadInventory(playerID);

        for (int i = 0; i < container.transform.childCount; i++)
        {
            Transform child = container.transform.GetChild(i);
            if (child.transform.name != "itemsEntryTemplate")
            {
                Destroy(child.gameObject);
            }
        }

        float templateHeight = 20f;

        for (int i = 0; i < slots.Count; i++)
        {
            Transform     entryTransform     = Instantiate(template, container);
            RectTransform entryRectTransform = entryTransform.GetComponent <RectTransform>();
            entryRectTransform.anchoredPosition = new Vector2(0, -templateHeight * i - 10);
            entryTransform.gameObject.SetActive(true);

            int slot_id = slots[i].id;

            entryTransform.Find("slotText").GetComponent <Text>().text     = slots[i].slotID.ToString();
            entryTransform.Find("itemText").GetComponent <Text>().text     = slots[i].item.name;
            entryTransform.Find("itemTypeText").GetComponent <Text>().text = slots[i].item.item_type;
            entryTransform.Find("quantityText").GetComponent <Text>().text = slots[i].quantity.ToString();

            Button editButton = entryTransform.Find("editButton").GetComponent <Button>();
            editButton.onClick.AddListener(() => inventoryDialogScript.EditInventory(slot_id, player_id));
        }
    }
 private static void OpenInventory(Player player)
 {
     try
     {
         InventoryDialog.ShowPlayerInventory(player);
     }
     catch (Exception e)
     {
         Chat.ErrorChat(player, e.Message);
     }
 }
Example #4
0
        private void MailSent(S.MailSent p)
        {
            InventoryDialog inventory  = GameScene.Scene.InventoryDialog;
            BeltDialog      beltDialog = GameScene.Scene.BeltDialog;

            for (int i = 0; i < inventory.Grid.Length; i++)
            {
                if (inventory.Grid[i].Locked)
                {
                    inventory.Grid[i].Locked = false;
                }
            }

            for (int i = 0; i < beltDialog.Grid.Length; i++)
            {
                if (beltDialog.Grid[i].Locked)
                {
                    beltDialog.Grid[i].Locked = false;
                }
            }

            GameScene.Scene.MailComposeParcelDialog.Hide();
        }
Example #5
0
        public void Execute()
        {
            Player pesho = new Player
            {
                Name      = "Pesho",
                Inventory = new List <IItem>
                {
                    new Axe(1, "Cepeni4kata", 99, Rarity.Common),
                    new Hammer(2, "Za dinozavrite", 15, Rarity.Epic),
                    new Sword(3, "Me4a na Ahil", 15, Rarity.Epic),
                    new Booklet(4, "Priklu4eniq", 15, Rarity.Epic),
                    new Sneaker(5, "Adidas", 15, Rarity.Epic),
                    new Sneaker(6, "Nike", 15, Rarity.Epic),
                    new Sneaker(7, "Reebok", 15, Rarity.Epic),
                    new Sneaker(8, "Puma", 15, Rarity.Epic),
                    new Sneaker(9, "Guma", 15, Rarity.Epic),
                }
            };

            var mall = new MallShop(1, "Mall of Sofia", null, 10, 10)
            {
                Inventory = new List <IItem>
                {
                    new Primer(10, "Primer", 55, Rarity.Epic),
                    new Overshoe(11, "Obushta", 60, Rarity.Epic)
                }
            };

            TradeDialog td = new TradeDialog(new Point(0, 0),
                                             pesho,
                                             mall
                                             );

            var id = new InventoryDialog <Player>(pesho, new Point(0, 0));

            td.Use();
        }
Example #6
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                Scene = null;
                User = null;

                MoveTime = 0;
                AttackTime = 0;
                NextRunTime = 0;
                CanMove = false;
                CanRun = false;

                MapControl = null;
                MainDialog = null;
                ChatDialog = null;
                ChatControl = null;
                InventoryDialog = null;
                CharacterDialog = null;
                StorageDialog = null;
                BeltDialog = null;
                MiniMapDialog = null;
                InspectDialog = null;
                OptionDialog = null;
                MenuDialog = null;
                NPCDialog = null;
                QuestDetailDialog = null;
                QuestListDialog = null;
                QuestLogDialog = null;
                QuestTrackingDialog = null;
                GameShopDialog = null;
                MentorDialog = null;

                RelationshipDialog = null;
                CharacterDuraPanel = null;
                DuraStatusPanel = null;

                HoverItem = null;
                SelectedCell = null;
                PickedUpGold = false;

                UseItemTime = 0;
                PickUpTime = 0;
                InspectTime = 0;

                DisposeItemLabel();

                AMode = 0;
                PMode = 0;
                Lights = 0;

                NPCTime = 0;
                NPCID = 0;
                DefaultNPCID = 0;

                for (int i = 0; i < OutputLines.Length; i++)
                    if (OutputLines[i] != null && OutputLines[i].IsDisposed)
                        OutputLines[i].Dispose();

                OutputMessages.Clear();
                OutputMessages = null;
            }

            base.Dispose(disposing);
        }
Example #7
0
        public GameScene()
        {
            MapControl.AutoRun = false;
            MapControl.AutoHit = false;
            Slaying = false;
            Thrusting = false;
            HalfMoon = false;
            CrossHalfMoon = false;
            DoubleSlash = false;
            TwinDrakeBlade = false;
            FlamingSword = false;

            GroupDialog.GroupList.Clear();

            Scene = this;
            BackColour = Color.Transparent;
            MoveTime = CMain.Time;

            KeyDown += GameScene_KeyDown;

            MainDialog = new MainDialog { Parent = this };
            ChatDialog = new ChatDialog { Parent = this };
            ChatControl = new ChatControlBar { Parent = this };
            InventoryDialog = new InventoryDialog { Parent = this };
            CharacterDialog = new CharacterDialog { Parent = this, Visible = false };
            BeltDialog = new BeltDialog { Parent = this };
            StorageDialog = new StorageDialog { Parent = this, Visible = false };
            MiniMapDialog = new MiniMapDialog { Parent = this };
            InspectDialog = new InspectDialog { Parent = this, Visible = false };
            OptionDialog = new OptionDialog { Parent = this, Visible = false };
            MenuDialog = new MenuDialog { Parent = this, Visible = false };
            NPCDialog = new NPCDialog { Parent = this, Visible = false };
            NPCGoodsDialog = new NPCGoodsDialog { Parent = this, Visible = false };
            NPCDropDialog = new NPCDropDialog { Parent = this, Visible = false };
            NPCAwakeDialog = new NPCAwakeDialog { Parent = this, Visible = false };

            HelpDialog = new HelpDialog { Parent = this, Visible = false };
            
            MountDialog = new MountDialog { Parent = this, Visible = false };
            FishingDialog = new FishingDialog { Parent = this, Visible = false };
            FishingStatusDialog = new FishingStatusDialog { Parent = this, Visible = false };
            
            GroupDialog = new GroupDialog { Parent = this, Visible = false };
            GuildDialog = new GuildDialog { Parent = this, Visible = false };
            GuildBuffDialog = new GuildBuffDialog { Parent = this, Visible = false };
            BigMapDialog = new BigMapDialog { Parent = this, Visible = false };
            TrustMerchantDialog = new TrustMerchantDialog { Parent = this, Visible = false };
            CharacterDuraPanel = new CharacterDuraPanel { Parent = this, Visible = false };
            DuraStatusPanel = new DuraStatusDialog { Parent = this, Visible = true };
            TradeDialog = new TradeDialog { Parent = this, Visible = false };
            GuestTradeDialog = new GuestTradeDialog { Parent = this, Visible = false };

            SkillBarDialog = new SkillBarDialog { Parent = this, Visible = false };
            ChatOptionDialog = new ChatOptionDialog { Parent = this, Visible = false };
            ChatNoticeDialog = new ChatNoticeDialog { Parent = this, Visible = false };

            QuestListDialog = new QuestListDialog { Parent = this, Visible = false };
            QuestDetailDialog = new QuestDetailDialog {Parent = this, Visible = false};
            QuestTrackingDialog = new QuestTrackingDialog { Parent = this, Visible = false };
            QuestLogDialog = new QuestDiaryDialog {Parent = this, Visible = false};

            RankingDialog = new RankingDialog { Parent = this, Visible = false };

            MailListDialog = new MailListDialog { Parent = this, Visible = false };
            MailComposeLetterDialog = new MailComposeLetterDialog { Parent = this, Visible = false };
            MailComposeParcelDialog = new MailComposeParcelDialog { Parent = this, Visible = false };
            MailReadLetterDialog = new MailReadLetterDialog { Parent = this, Visible = false };
            MailReadParcelDialog = new MailReadParcelDialog { Parent = this, Visible = false };

            IntelligentCreatureDialog = new IntelligentCreatureDialog { Parent = this, Visible = false };//IntelligentCreature
            IntelligentCreatureOptionsDialog = new IntelligentCreatureOptionsDialog { Parent = this, Visible = false };//IntelligentCreature
            IntelligentCreatureOptionsGradeDialog = new IntelligentCreatureOptionsGradeDialog { Parent = this, Visible = false };//IntelligentCreature

            RefineDialog = new RefineDialog { Parent = this, Visible = false };
            RelationshipDialog = new RelationshipDialog { Parent = this, Visible = false };
            FriendDialog = new FriendDialog { Parent = this, Visible = false };
            MemoDialog = new MemoDialog { Parent = this, Visible = false };
            MentorDialog = new MentorDialog { Parent = this, Visible = false };
            GameShopDialog = new GameShopDialog { Parent = this, Visible = false };

            //not added yet
            KeyboardLayoutDialog = new KeyboardLayoutDialog { Parent = this, Visible = false };
            

            

            for (int i = 0; i < OutputLines.Length; i++)
                OutputLines[i] = new MirLabel
                {
                    AutoSize = true,
                    BackColour = Color.Transparent,
                    Font = new Font(Settings.FontName, 10F),
                    ForeColour = Color.LimeGreen,
                    Location = new Point(20, 25 + i * 13),
                    OutLine = true,
                };
        }
        public override void Execute()
        {
            try
            {
                object state = AutomationContext.Read(memoryServiceName, memoryItemName);
                if (state == null || state.ToString() != "InventoryWholePalletScan")
                {
                    return;
                }

                int taskID = 0, positionID = 0;
                state = AutomationContext.Read(memoryServiceName1, memoryItemName1);
                object obj = ObjectUtil.GetObjects(state);
                if (obj is Array)
                {
                    Array arrayObj = (Array)obj;
                    if (arrayObj.Length == 2)
                    {
                        taskID     = Convert.ToInt32(arrayObj.GetValue(0));
                        positionID = Convert.ToInt32(arrayObj.GetValue(1));
                    }
                }
                if (taskID == 0 || positionID == 0)
                {
                    return;
                }

                //弹出输入窗,获取数量;
                state = AutomationContext.Read(memoryServiceName2, memoryItemName2);
                if (state != null)
                {
                    UserLookAndFeel.Default.SetSkinStyle(state.ToString());
                }

                InventoryDialog inventoryDialog = new InventoryDialog(taskID);
                if (inventoryDialog.ShowDialog() == DialogResult.OK)
                {
                    RestClient rest = new RestClient();
                    taskID = rest.FinishInventoryTask(taskID, inventoryDialog.RealQuantity);
                    if (taskID > 0)
                    {
                        string positionName = taskDal.GetTaskNextPosition(taskID);
                        if (positionName != string.Empty)
                        {
                            int[] data = new int[] { taskID, Convert.ToInt32(positionName), 1 };
                            AutomationContext.Write(plcServiceName, O_Whole_Pallet_StockIn_Task_Info, data);
                            Thread.Sleep(sleepTime);
                            obj = AutomationContext.Read(plcServiceName, I_Whole_Pallet_StockIn_Task_Info);
                            obj = ObjectUtil.GetObjects(obj);
                            if (obj is Array)
                            {
                                Array arrayObj = (Array)obj;
                                if (arrayObj.Length == 3 &&
                                    data[0] == Convert.ToInt32(arrayObj.GetValue(0)) &&
                                    data[1] == Convert.ToInt32(arrayObj.GetValue(1)) &&
                                    data[2] == Convert.ToInt32(arrayObj.GetValue(2)))
                                {
                                    AutomationContext.Write(plcServiceName, O_Whole_Pallet_StockIn_Task_Info_Complete, 1);
                                    AutomationContext.Write(memoryServiceName1, memoryItemName1, 0);
                                    positionDal.UpdateHasGoodsToFalse(positionID);
                                }
                            }
                        }
                    }
                    else if (taskID == -1)
                    {
                        positionDal.UpdateHasGoodsToFalse(positionID);
                        AutomationContext.Write(memoryServiceName1, memoryItemName1, 0);
                    }
                }
                inventoryDialog = null;
                GC.Collect();
            }
            catch (Exception ex)
            {
                Logger.Error("InventoryWholePalletScanProcess 出错,原因:" + ex.Message + "/n" + ex.StackTrace);
            }
        }
Example #9
0
        private void Inventory_Click(object sender, RoutedEventArgs e)
        {
            var inventory = new InventoryDialog();

            inventory.ShowDialog();
        }