Esempio n. 1
0
        public void UseItem(int character, int item, ItemUsage usage)
        {
            var usableItem = EntityManager.GetComponent <UsableItemComponent>(item);

            if (usableItem == null)
            {
                UISystem.Message("You can't use that!");
                return;
            }

            if (!usableItem.Usages.Contains(usage))
            {
                UISystem.Message("You can't use that like that!");
                return;
            }

            UISystem.Message(DescriptionSystem.GetNameWithID(character) + " uses " + DescriptionSystem.GetNameWithID(item) + " -> " + usage);

            switch (usage)
            {
            case ItemUsage.Consume:
                ConsumeItem(character, item);
                break;

            case ItemUsage.Throw:
                // TODO: throwing range
                InputManager.Instance.InitiateTargeting((pos) => ThrowItem(character, item, pos));
                break;
            }
        }
Esempio n. 2
0
            static Modes()
            {
                Menu = MenuManager.Menu.AddSubMenu("Modes");

                Combo.Initialize();
                Menu.AddSeparator();
                Harass.Initialize();
                Menu.AddSeparator();
                LastHit.Initialize();
                Menu.AddSeparator();
                LaneClear.Initialize();
                Menu.AddSeparator();
                JungleClear.Initialize();
                Menu.AddSeparator();

                Menu        = MenuManager.Menu.AddSubMenu("Condemn");
                CondemnMenu = Menu;
                Condemn.Initialize();

                Menu = MenuManager.Menu.AddSubMenu("Misc");
                Misc.Initialize();

                Menu = MenuManager.Menu.AddSubMenu("Activator");
                ItemUsage.Initialize();

                Menu = MenuManager.Menu.AddSubMenu("Gosu");
                Gosu.Initialize();
            }
Esempio n. 3
0
        private void Btn_ItemUsageMod_Click(object sender, RoutedEventArgs e)
        {
            InventoryManagementWindow invWindow = new InventoryManagementWindow(VM.InventoryManager);

            invWindow.ShowDialog();

            if (invWindow.DialogResult == true)
            {
                foreach (InventoryItem item in VM.InventoryManager.InventoryUsage)
                {
                    ItemUsage usage = Procedure.InventoryUsage.SingleOrDefault(i => i.ItemId == item.Id);

                    if (usage == null)
                    {
                        usage = new ItemUsage(0, item.Id, item.Name, item.Quantity, item.Unit);
                        Procedure.InventoryUsage.Add(usage);
                    }
                    else
                    {
                        usage.Quantity += item.Quantity;
                    }
                }

                VM.InventoryManager.InventoryUsage.Clear();
                ListBox_InventoryUsage.Items.Refresh();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 重设当前可显示的内容,为各项内容间加上空格
        /// </summary>
        protected override void ResetDisplayTexts()
        {
            InitBaseDisplayTexts();

            // 顺序为:项目 数量单位 [用法] [频次] [嘱托]
            if (Item == null) // 如果没有项目,则默认为显示内容为空
            {
                return;
            }

            string tail = ""; // 长度大于1表示已经有结尾了,已便于在各项内容间插入空格

            if (!String.IsNullOrEmpty(EntrustContent))
            {
                Texts.Insert(0, new OutputInfoStruct(EntrustContent.Trim()
                                                     , OrderOutputTextType.EntrustContent));
                tail = " ";
            }
            // 长期医嘱才显示频次
            if ((ParentOrder == null) || (ParentOrder.GetType() == typeof(LongOrder)))
            {
                if ((ItemFrequency != null) && (ItemFrequency.KeyInitialized))
                {
                    Texts.Insert(0, new OutputInfoStruct(ItemFrequency.ToString().Trim() + tail
                                                         , OrderOutputTextType.ItemFrequency));
                    if (tail.Length == 0)
                    {
                        tail = " ";
                    }
                }
            }
            if ((ItemUsage != null) && (ItemUsage.KeyInitialized))
            {
                Texts.Insert(0, new OutputInfoStruct(ItemUsage.ToString().Trim() + tail
                                                     , OrderOutputTextType.ItemUsage));
                if (tail.Length == 0)
                {
                    tail = " ";
                }
            }

            // 要根据项目的显示控制属性来决定显示的内容
            ChargeItem chargeItem = Item as ChargeItem;

            if ((chargeItem.PrintAttributes & ItemPrintAttributeFlag.NotShowAmount) == 0)
            {
                Texts.Insert(0
                             //, new OutputInfoStruct(Amount.ToString("#.##", CultureInfo.CurrentCulture) + CurrentUnit.Name.Trim() + tail
                             , new OutputInfoStruct(Amount.ToString() + CurrentUnit.Name.Trim() + tail
                                                    , OrderOutputTextType.ItemAmount));
                if (tail.Length == 0)
                {
                    tail = " ";
                }
            }

            Texts.Insert(0, new OutputInfoStruct(Item.Name.Trim() + tail
                                                 , OrderOutputTextType.ItemName));
        }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FreezingArcher.Messaging.ItemUseMessage"/> class.
 /// </summary>
 /// <param name="entity">Entity on which the usage should be applied.</param>
 /// <param name="usage">Usage which should be applied when sending this message.</param>
 public ItemUseMessage(Entity entity, CoreScene scene, ItemComponent item, ItemUsage usage)
 {
     Usage = usage;
     Entity = entity;
     Item = item;
     Scene = scene;
     MessageId = (int) Messaging.MessageId.ItemUse;
 }
Esempio n. 6
0
        public void RemoveInventory(GameClient Client)
        {
            ItemUsage Packet = new ItemUsage();

            Packet.Size    = (ushort)sizeof(ItemUsage);
            Packet.Type    = 0x3F1;
            Packet.Timer   = (uint)System.Environment.TickCount;
            Packet.UsageID = ItemUsageIDs.RemoveInventory;
            Packet.ID      = UID;
            Client.Send(&Packet, Packet.Size);
        }
Esempio n. 7
0
        public void Unequip(GameClient Client)
        {
            ItemUsage Packet = new ItemUsage();

            Packet.Size     = (ushort)sizeof(ItemUsage);
            Packet.Type     = 0x3F1;
            Packet.Timer    = (uint)System.Environment.TickCount;
            Packet.UsageID  = ItemUsageIDs.UnequipItem;
            Packet.Location = (uint)Position;
            Packet.ID       = UID;
            Client.Send(&Packet, Packet.Size);
        }
Esempio n. 8
0
    IEnumerator BattleDuration(float duration)
    {
        yield return(new WaitForSeconds(duration));

        UITextTypeWriter  Type   = gameObject.GetComponent <UITextTypeWriter> ();
        MainMenuTxt       MenTxt = Heart.GetComponent <MainMenuTxt> ();
        TalkBox           TalkB  = gameObject.GetComponent <TalkBox> ();//TalkBox
        MainMenuTxt       Main   = Heart.GetComponent <MainMenuTxt> ();
        HitSound          Hs     = Atk_0.GetComponent <HitSound> ();
        ItemUsage         IU     = ItemUsage.GetComponent <ItemUsage> ();
        Initialise_Button IB     = NoLostFocus.GetComponent <Initialise_Button> ();

        //Attacks Atk = Attack.GetComponent<Attacks> ();

        InBattle           = false;
        Fight.enabled      = true;
        Fight.interactable = true;
        Act.enabled        = true;
        Act.interactable   = true;
        Mercy.enabled      = true;
        Mercy.interactable = true;
        Item.enabled       = true;
        Item.interactable  = true;
        if (lastselect2.ToString() == "Fight")
        {
            Fight.Select();
        }
        else if (lastselect2.ToString() == "Act")
        {
            Act.Select();
        }
        else if (lastselect2.ToString() == "Item")
        {
            Item.Select();
        }
        else if (lastselect2.ToString() == "Mercy")
        {
            Mercy.Select();
        }
        Heart.transform.position = FightPos.position;
        //AtkDamage.Stop ();
        Atk_0.enabled = false;
        //BattleBg.enabled = false;
        TextBoxAnim.Play("TextBox1Reverse");
        Hs.enabled            = false;
        IU.Item1_2Finished    = false;
        Main.Neutral         += 1;
        TalkB.TalkingProgress = false;
        Attack.CancelSpawn    = true;
        Attack.RemoveLaser();
        //yield return true;
    }
Esempio n. 9
0
 static Modes()
 {
     Menu = Config.Menu.AddSubMenu("Modes");
     Menu.AddSeparator();
     Combo.Initialize();
     Menu.AddSeparator();
     LaneClear.Initialize();
     Harass.Initialize();
     JungleClear.Initialize();
     DrawDmg.Initialize();
     Skilldraws.Initialize();
     ItemUsage.Initialize();
 }
Esempio n. 10
0
        private void UseItem(ItemUsage usage)
        {
            var item = Util.GetCurrentItem();

            if (!ItemUsable(item, usage))
            {
                return;
            }

            var usableItem = EntityManager.GetComponent <UsableItemComponent>(item);

            ItemUsedEvent?.Invoke(ControlledEntity, item, usage);
        }
Esempio n. 11
0
        private async Task leaveRoom(MultiplayerClientState state, ItemUsage <MultiplayerRoom> roomUsage)
        {
            var room = roomUsage.Item;

            if (room == null)
            {
                throw new InvalidOperationException("Attempted to operate on a null room");
            }

            Log($"Leaving room {room.RoomID}");

            await Groups.RemoveFromGroupAsync(state.ConnectionId, GetGroupId(room.RoomID, true));

            await Groups.RemoveFromGroupAsync(state.ConnectionId, GetGroupId(room.RoomID));

            var user = room.Users.Find(u => u.UserID == state.UserId);

            if (user == null)
            {
                throw new InvalidStateException("User was not in the expected room.");
            }

            room.Users.Remove(user);
            await removeDatabaseUser(room, user);

            // handle closing the room if the only participant is the user which is leaving.
            if (room.Users.Count == 0)
            {
                await endDatabaseMatch(room);

                // only destroy the usage after the database operation succeeds.
                Log($"Stopping tracking of room {room.RoomID} (all users left).");
                roomUsage.Destroy();
                return;
            }

            await updateRoomStateIfRequired(room);

            var clients = Clients.Group(GetGroupId(room.RoomID));

            // if this user was the host, we need to arbitrarily transfer host so the room can continue to exist.
            if (room.Host?.Equals(user) == true)
            {
                // there *has* to still be at least one user in the room (see user check above).
                var newHost = room.Users.First();

                await setNewHost(room, newHost);
            }

            await clients.UserLeft(user);
        }
Esempio n. 12
0
 /// <summary>
 /// 初始化所有的属性,包括引用类型的属性自己的属性
 /// </summary>
 public override void ReInitializeAllProperties()
 {
     if (Item != null)
     {
         Item.ReInitializeAllProperties();
     }
     if (ItemUsage != null)
     {
         ItemUsage.ReInitializeAllProperties();
     }
     if (ItemFrequency != null)
     {
         ItemFrequency.ReInitializeAllProperties();
     }
 }
Esempio n. 13
0
    IEnumerator PlayText()
    {
        foreach (char c in story)
        {
            txt.text += c;
            Fx.Stop();
            Fx.Play();
            yield return(0);

            yield return(new WaitForSeconds(Delay));
        }
        ItemUsage IU = ItemUsage.GetComponent <ItemUsage> ();

        IU.Item1_2Finished = true;
    }
Esempio n. 14
0
        /// <summary>
        /// 重设当前可显示的内容,为各项内容间加上空格
        /// </summary>
        protected override void ResetDisplayTexts()
        {
            InitBaseDisplayTexts();

            // 顺序为:项目 数量单位 [用法] [频次] [嘱托]
            if (Item == null) // 如果没有项目,则默认为显示内容为空
            {
                return;
            }

            string tail = ""; // 长度大于1表示已经有结尾了,已便于在各项内容间插入空格

            if ((Attributes & OrderAttributeFlag.Provide4Oneself) > 0)
            {
                Texts.Insert(0, new OutputInfoStruct("自备", OrderOutputTextType.SelfProvide));
                tail = " ";
            }
            if (!String.IsNullOrEmpty(EntrustContent))
            {
                Texts.Insert(0, new OutputInfoStruct(EntrustContent.Trim(), OrderOutputTextType.EntrustContent));
                tail = " ";
            }
            // 长期医嘱才显示频次
            if ((ParentOrder == null) || (ParentOrder.GetType() == typeof(LongOrder)))
            {
                if ((ItemFrequency != null) && (ItemFrequency.KeyInitialized))
                {
                    Texts.Insert(0, new OutputInfoStruct(ItemFrequency.ToString().Trim() + tail, OrderOutputTextType.ItemFrequency));
                    if (tail.Length == 0)
                    {
                        tail = " ";
                    }
                }
            }
            if ((ItemUsage != null) && (ItemUsage.KeyInitialized))
            {
                Texts.Insert(0, new OutputInfoStruct(ItemUsage.ToString().Trim() + tail, OrderOutputTextType.ItemUsage));
                if (tail.Length == 0)
                {
                    tail = " ";
                }
            }

            Texts.Insert(0, new OutputInfoStruct(Amount.ToString() + CurrentUnit.Name.Trim() + tail, OrderOutputTextType.ItemAmount));

            Texts.Insert(0, new OutputInfoStruct(Item.ToString().Trim() + " ", OrderOutputTextType.ItemName));
        }
Esempio n. 15
0
    public void MovePos()
    {
        if (Input.GetAxisRaw("Cancel") == 0)
        {
            ItemUsage Item = ItemUsage.GetComponent <ItemUsage> ();



            if (Item.IsItem1 && Item.IsItem2 && Item.IsItem3 && Item.IsItem4)
            {
            }
            else
            {
                OnItemMenu = true;
                Heart.transform.position = ItemPos1.transform.position;
            }
        }
    }
Esempio n. 16
0
        /// <summary>
        /// 重设当前可显示的内容,为各项内容间加上空格
        /// </summary>
        protected override void ResetDisplayTexts()
        {
            InitBaseDisplayTexts();

            // 顺序为:项目 数量单位 [用法] [频次] 天数 [嘱托]
            if (Item == null) // 如果没有项目,则默认为显示内容为空
            {
                return;
            }

            string tail = ""; // 长度大于1表示已经有结尾了,已便于在各项内容间插入空格

            if ((Attributes & OrderAttributeFlag.Provide4Oneself) > 0)
            {
                Texts.Insert(0, new OutputInfoStruct("自备", OrderOutputTextType.SelfProvide));
                tail = " ";
            }
            if (!String.IsNullOrEmpty(EntrustContent))
            {
                Texts.Insert(0, new OutputInfoStruct(EntrustContent.Trim(), OrderOutputTextType.EntrustContent));
                tail = " ";
            }
            Texts.Insert(0, new OutputInfoStruct(ExecuteDays.ToString("#'天'", CultureInfo.CurrentCulture), OrderOutputTextType.ItemDays));
            if (tail.Length == 0)
            {
                tail = " ";
            }

            if ((ItemFrequency != null) && (ItemFrequency.KeyInitialized))
            {
                Texts.Insert(0, new OutputInfoStruct(ItemFrequency.ToString().Trim() + tail, OrderOutputTextType.ItemFrequency));
            }
            if ((ItemUsage != null) && (ItemUsage.KeyInitialized))
            {
                Texts.Insert(0, new OutputInfoStruct(ItemUsage.ToString().Trim() + tail, OrderOutputTextType.ItemUsage));
            }

            Texts.Insert(0, new OutputInfoStruct(Amount.ToString("#.##", CultureInfo.CurrentCulture) + CurrentUnit.Name.Trim() + tail, OrderOutputTextType.ItemAmount));

            Texts.Insert(0, new OutputInfoStruct(Item.ToString().Trim() + tail, OrderOutputTextType.ItemName));
        }
Esempio n. 17
0
        /// <summary>
        /// checks if item is usable
        /// prints problems to player if any
        /// </summary>
        /// <returns> wether item is usable </returns>
        private bool ItemUsable(int item, ItemUsage usage)
        {
            if (item == 0)
            {
                UISystem.Message("Your inventory is empty!");
                return(false);
            }

            var usableItem = EntityManager.GetComponent <UsableItemComponent>(item);

            if (usableItem == null)
            {
                UISystem.Message("You can't use that!");
                return(false);
            }

            if (!usableItem.Usages.Contains(usage))
            {
                UISystem.Message("Item usage:");
                foreach (var action in usableItem.Usages)
                {
                    Keys key = Keys.None;
                    switch (action)
                    {
                    case ItemUsage.Consume:
                        key = GetKeybinding(Command.ConsumeItem, CommandDomain.Inventory);
                        break;

                    case ItemUsage.Throw:
                        key = GetKeybinding(Command.ThrowItem, CommandDomain.Inventory);
                        break;
                    }
                    UISystem.Message(key + " -> " + action);
                }
                return(false);
            }
            return(true);
        }
Esempio n. 18
0
    public void WhenClicked()
    {
        Atk.CancelSpawn = false;
        if (Input.GetAxisRaw("Cancel") == 0)
        {
            ItemUsage        Item   = ItemUsage.GetComponent <ItemUsage> ();
            UITextTypeWriter Text   = TextBox.GetComponent <UITextTypeWriter> ();
            HeartMove        HeartP = Heart.GetComponent <HeartMove> ();
            if (Item.IsItem1 && Item.IsItem2 && Item.IsItem3 && Item.IsItem4)
            {
                SelectFX.Play();
                Text.StopAllCoroutines();
            }
            else
            {
                if (Input.GetAxisRaw("Horizontal") == 1 || Input.GetAxisRaw("Vertical") == -1)
                {
                    HeartP.KeyPressed = true;
                }


                TextBox.enabled         = false;
                x.enabled               = false;
                Page.enabled            = true;
                ItemButton.enabled      = false;
                ItemButton.interactable = false;
                UITextTypeWriter UI = TextBoxCode.GetComponent <UITextTypeWriter> ();
                UI.StopAllCoroutines();
                SelectFX.Play();
                HeartP.HeartPos = 1;
                NOfClicks       = 1;
            }

            if (Item.IsItem1 && Item.IsItem2 && Item.IsItem3 && Item.IsItem4)
            {
            }
            else if (Item.IsItem1 && Item.IsItem2 && Item.IsItem3)
            {
                Item4.enabled            = true;
                Item4.transform.position = ItemPos1Temp.transform.position;
                Item4Pos = 1;
            }
            else if (Item.IsItem4 && Item.IsItem2 && Item.IsItem3)
            {
                Item1.enabled = true;
                Item1Pos      = 1;
            }
            else if (Item.IsItem1 && Item.IsItem3 && Item.IsItem4)
            {
                Item2.enabled            = true;
                Item2.transform.position = ItemPos1Temp.transform.position;
                Item2Pos = 1;
            }
            else if (Item.IsItem1 && Item.IsItem2 && Item.IsItem4)
            {
                Item3.enabled            = true;
                Item3.transform.position = ItemPos1Temp.transform.position;
                Item3Pos = 1;
            }
            else if (Item.IsItem1 && Item.IsItem2)
            {
                Item4.enabled            = true;
                Item3.enabled            = true;
                Item4.transform.position = ItemPos1Temp.transform.position;
                Item4Pos = 1;
            }
            else if (Item.IsItem3 && Item.IsItem4)
            {
                Item1.enabled            = true;
                Item2.enabled            = true;
                Item2.transform.position = ItemPos3Temp.transform.position;
                Item2Pos = 3;
            }
            else if (Item.IsItem1 && Item.IsItem4)
            {
                Item2.enabled            = true;
                Item3.enabled            = true;
                Item2.transform.position = ItemPos1Temp.transform.position;
                Item2Pos = 1;
            }
            else if (Item.IsItem3 && Item.IsItem1)
            {
                Item4.enabled            = true;
                Item2.enabled            = true;
                Item4.transform.position = ItemPos3Temp.transform.position;
                Item2.transform.position = ItemPos1Temp.transform.position;
                Item4Pos = 3;
                Item2Pos = 1;
            }
            else
            {
                if (Item.IsItem1 == false)
                {
                    Item1.enabled = true;
                }
                else
                {
                    Item4.transform.position = ItemPos1Temp.transform.position;

                    Item4Pos = 1;
                    Item1Pos = 0;
                }
                if (Item.IsItem2 == false)
                {
                    Item2.enabled = true;
                }
                else
                {
                    Item4.transform.position = ItemPos2Temp.transform.position;

                    Item4Pos = 2;
                    Item2Pos = 0;
                }

                if (Item.IsItem3 == false)
                {
                    Item3.enabled = true;
                }
                else
                {
                    Item4.transform.position = ItemPos3Temp.transform.position;
                    Item4Pos = 3;
                    Item3Pos = 0;
                }

                if (Item.IsItem4 == false)
                {
                    Item4.enabled = true;
                }
                else
                {
                    Item4Pos = 0;
                }
            }
        }
    }
Esempio n. 19
0
 public void Unequip(GameClient Client)
 {
     ItemUsage Packet = new ItemUsage();
     Packet.Size = (ushort)sizeof(ItemUsage);
     Packet.Type = 0x3F1;
     Packet.Timer = (uint)System.Environment.TickCount;
     Packet.UsageID = ItemUsageIDs.UnequipItem;
     Packet.Location = (uint)Position;
     Packet.ID = UID;
     Client.Send(&Packet, Packet.Size);
 }
Esempio n. 20
0
 public void RemoveInventory(GameClient Client)
 {
     ItemUsage Packet = new ItemUsage();
     Packet.Size = (ushort)sizeof(ItemUsage);
     Packet.Type = 0x3F1;
     Packet.Timer = (uint)System.Environment.TickCount;
     Packet.UsageID = ItemUsageIDs.RemoveInventory;
     Packet.ID = UID;
     Client.Send(&Packet, Packet.Size);
 }
Esempio n. 21
0
    public void InitFromLuaFile()
    {
        SLua.LuaTable _table;
        //Script prefix path: Assets/Scripts/Lua/
        //read file
        _table = (SLua.LuaTable)SLua.LuaSvr.getInstance().doFile("Items/" + m_LuaScript);

        //onuse function
        SLua.LuaFunction _func = (SLua.LuaFunction)SLua.LuaSvr.mainState["OnUse"];
        if (_func != null)
        {
            m_UsageDelegate += _func.cast <ItemUsage>();
        }

        //load all the properties
        _table = (SLua.LuaTable)SLua.LuaSvr.mainState["properties"];

        //load mesh
        m_Prefab = (string)_table["Mesh"];
        //GameObject _tmp = Resources.Load<GameObject>("Prefabs/"+m_Prefab);
        GameObject _tmp = Resources.Load <GameObject>("Meshes/" + m_Prefab);

        _tmp = Instantiate(_tmp);
        gameObject.AddComponent <MeshFilter>();
        gameObject.AddComponent <MeshRenderer>();
        gameObject.GetComponent <MeshFilter>().mesh   = _tmp.GetComponent <MeshFilter>().mesh;
        gameObject.GetComponent <Renderer>().material = _tmp.GetComponent <Renderer>().material;
        gameObject.transform.localScale = _tmp.transform.localScale;
        GameObject.Destroy(_tmp);

        //attributes
        m_ItemName    = (string)_table["Name"];
        m_Description = (string)_table["Description"];

        m_Type = (ItemType)System.Convert.ToInt32(_table["Type"]);
        switch (m_Type)
        {
        case ItemType.ITEM_PRIMARY:
            m_ShotType    = (ShotType)System.Convert.ToInt32(_table["ShotType"]);
            m_AttackSpeed = System.Convert.ToSingle(_table["AttackSpeed"]);
            m_EnergyCost  = System.Convert.ToSingle(_table["EnergyCost"]);
            m_Damage      = System.Convert.ToSingle(_table["FirePower"]);
            break;

        case ItemType.ITEM_MELEE:
            m_Damage      = System.Convert.ToSingle(_table["Damage"]);
            m_AttackSpeed = System.Convert.ToSingle(_table["AttackSpeed"]);
            break;

        case ItemType.ITEM_PARTS:
            m_Damage     = System.Convert.ToSingle(_table["Damage"]);
            m_Projectile = (string)_table["Ammo"];
            break;

        case ItemType.ITEM_ARMOR:
            m_Armor = System.Convert.ToSingle(_table["Armor"]);
            break;

        default:
            break;
        }
        m_Weight = System.Convert.ToSingle(_table["Weight"]);

        SLua.LuaTable _bonus = (SLua.LuaTable)_table["Bonus"];
        m_BonusList = new DAttributeBonus[_bonus.length()];
        for (int i = 1; i <= _bonus.length(); i++)
        {
            SLua.LuaTable _oneBonus = (SLua.LuaTable)_bonus[i];
            m_BonusList[i - 1] = new DAttributeBonus(
                (AttrType)System.Convert.ToInt32(_oneBonus[1]),
                System.Convert.ToSingle(_oneBonus[3]),
                System.Convert.ToBoolean(_oneBonus[2])
                );
        }

        m_bIfLoaded = true;
    }
Esempio n. 22
0
        internal void WRecv(Player selectPlayer, string[] msgs)
        {
            List <string> data = new List <string>();

            switch (msgs[0])
            {
            case "damageSelf":
                if (selectPlayer.IsDead)
                {
                    return;
                }
                if (!CheckPam(msgs, 3, 2))
                {
                    return;
                }

                if (IsInSafeArea(selectPlayer.Location, true))
                {
                    break;
                }

                selectPlayer.LastDamageSourceStr = msgs[1];
                selectPlayer.Health -= float.Parse(msgs[2]);

                if (selectPlayer.Health > 0)
                {
                    selectPlayer.IsInAttackAnimation = true;
                    selectPlayer.animDelay.SetDelay(500, () => selectPlayer.IsInAttackAnimation = false);
                }

                data.Add("damage");
                data.Add(msgs[1]);
                data.Add(selectPlayer.Health.ToString());

                selectPlayer.SendDataPackage(data);
                break;

            case "damageOther":
                string killerName = selectPlayer.Name;
                Player killer     = selectPlayer;

                if (selectPlayer.IsDead)
                {
                    return;
                }
                if (!CheckPam(msgs, 4, 2))
                {
                    return;
                }

                if (IsInSafeArea(selectPlayer.Location, false))
                {
                    break;
                }

                string attackObj = msgs[3];
                if (msgs[3].Contains("onlineplayer_"))
                {
                    attackObj = msgs[3].Substring(13);
                }

                selectPlayer = FindPlayer(attackObj);
                if (selectPlayer == null)
                {
                    return;
                }

                if (IsInSafeArea(selectPlayer.Location, false))
                {
                    break;
                }
                if (selectPlayer.IsDead)
                {
                    break;
                }

                selectPlayer.LastDamageSourceStr = msgs[1];
                selectPlayer.Health -= float.Parse(msgs[2]);

                if (selectPlayer.Health <= 0)
                {
                    if (selectPlayer.XCoin >= 500)
                    {
                        int xcoin = selectPlayer.XCoin / 40;
                        if (xcoin > 1000)
                        {
                            xcoin = 1000;
                        }
                        selectPlayer.XCoin -= xcoin;
                        selectPlayer.SendChat("你失去了" + xcoin + "X币", "Forgetive");
                        killer.XCoin += xcoin;
                        killer.SendChat("你得到了" + xcoin + "X币", "Forgetive");
                        SendAllChat(killerName + " 击杀了 " + selectPlayer.Name + " 并抢夺了财产 " + xcoin + "X币", "Forgetive");
                    }
                    else
                    {
                        SendAllChat(killerName + " 击杀了 " + selectPlayer.Name, "Forgetive");
                    }
                }
                else
                {
                    selectPlayer.IsInAttackAnimation = true;
                    selectPlayer.animDelay.SetDelay(500, () => selectPlayer.IsInAttackAnimation = false);
                }

                data.Add("damage");
                data.Add(msgs[1]);
                data.Add(selectPlayer.Health.ToString());

                selectPlayer.SendDataPackage(data);
                break;

            case "updateSelf":
            {
                if (selectPlayer.IsDead)
                {
                    return;
                }
                if (selectPlayer.LastLocation == Vector3.Zero)
                {
                    selectPlayer.LastLocation = new Vector3(-1f, -1f, -1f);
                }
                else
                {
                    selectPlayer.LastLocation = selectPlayer.Location;
                }
                selectPlayer.Location = new Vector3(msgs[1]);
                selectPlayer.Rotation = new Vector3(msgs[2]);
                int.TryParse(msgs[3], out selectPlayer.State);
                selectPlayer.CalcLocationChanged();
            }
            break;

            case "getUserItems":
                data.Add("updateFullItems");
                for (int i = 0; i < selectPlayer.Items.Count; i++)
                {
                    int  index    = selectPlayer.Items[i];
                    Item itemdesc = ItemStorage.GetItemDesc(index);
                    if (itemdesc == null)
                    {
                        continue;
                    }
                    data.Add(itemdesc.ItemStaticId.ToString());
                    data.Add(itemdesc.ServerId.ToString());
                    data.Add(Base64Encode(itemdesc.DescribeMessage));
                    data.Add(Base64Encode(itemdesc.ExtraInfo));
                    data.Add("next");
                }
                selectPlayer.SendDataPackage(data);
                data = new List <string>();
                data.Add("updateDockItems");
                for (int i = 0; i < selectPlayer.BarItemsId.Count; i++)
                {
                    data.Add(selectPlayer.BarItemsId[i].ToString());
                }
                selectPlayer.SendDataPackage(data);

                break;

            case "setUserDocks":
                if (selectPlayer.IsDead)
                {
                    return;
                }
                List <int> dockIds = new List <int>();
                for (int i = 0; i < msgs.Length; i++)
                {
                    if (i == 0)
                    {
                        continue;
                    }
                    int id = int.Parse(msgs[i]);
                    dockIds.Add(id);
                }
                selectPlayer.BarItemsId = dockIds;
                break;

            case "useItem":
            {
                if (selectPlayer.IsDead)
                {
                    return;
                }
                int    itemStaticId = int.Parse(msgs[1]);
                int    serverId     = int.Parse(msgs[2]);
                string desc         = Base64Decode(msgs[3]);
                string extra        = Base64Decode(msgs[4]);
                for (int i = 0; i < selectPlayer.Items.Count; i++)
                {
                    if (selectPlayer.Items[i] == serverId)
                    {
                        ItemStorage.SetChanged(serverId, itemStaticId, desc, extra);
                    }
                }
            }
            break;

            case "tryControlBlock":
            {
                if (selectPlayer.IsDead)
                {
                    return;
                }
                string blockName = msgs[1];
                Player srcPlayer = null;
                bool   findBlock = false;
                for (int i = 0; i < blocks.Count; i++)
                {
                    if (blocks[i].blockId == blockName)
                    {
                        srcPlayer = FindPlayer(blocks[i].controllerName);
                        blocks[i].controllerName = selectPlayer.Name;
                        findBlock = true;
                        break;
                    }
                }
                if (!findBlock)
                {
                    Block block = new Block();
                    block.blockId        = blockName;
                    block.controllerName = selectPlayer.Name;
                    blocks.Add(block);
                }
                if (srcPlayer != null)
                {
                    if (selectPlayer.Name == srcPlayer.Name)
                    {
                        return;
                    }
                }
                data.Add("updateBlockController");
                data.Add(blockName);
                data.Add(bool.TrueString);
                selectPlayer.SendDataPackage(data);
                Logger.WriteLine(selectPlayer.Name + "已获得对" + blockName + "的控制权");
                if (srcPlayer == null)
                {
                    return;
                }
                data = new List <string>();
                data.Add("updateBlockController");
                data.Add(blockName);
                data.Add(bool.FalseString);
                srcPlayer.SendDataPackage(data);
                Logger.WriteLine(selectPlayer.Name + "已失去对" + blockName + "的控制权");
            }
            break;

            case "sendBlockState":
            {
                if (selectPlayer.IsDead)
                {
                    return;
                }
                Block   selectBlock = null;
                string  id          = msgs[1];
                Vector3 lctn        = new Vector3(msgs[2]);
                Vector3 rotn        = new Vector3(msgs[3]);
                for (int i = 0; i < blocks.Count; i++)
                {
                    if (blocks[i].blockId == id)
                    {
                        selectBlock = blocks[i];
                        break;
                    }
                }
                if (selectBlock == null)
                {
                    return;
                }
                if (selectBlock.controllerName != selectPlayer.Name)
                {
                    return;
                }
                selectBlock.updateLocation = lctn;
                selectBlock.updateRotation = rotn;

                data.Add("updateBlock");
                data.Add(id);
                data.Add(lctn.ToXYZ());
                data.Add(rotn.ToXYZ());
                data.Add(selectBlock.blockType.ToString());

                SendAll(data);

                //for (int i = 0; i < players.Count; i++)
                //{
                //    Player user = players[i];
                //    if (user != null)
                //    {
                //        if (user.SocketState != null)
                //        {
                //            if (user.SocketState.OtherData != null)
                //            {
                //                user.SocketState.OtherData.Add(new List_String(data));
                //            }
                //        }
                //    }
                //}
            }
            break;

            case "getBlocks":
                for (int i = 0; i < blocks.Count; i++)
                {
                    data = new List <string>();
                    data.Add("updateBlock");
                    data.Add(blocks[i].blockId);
                    data.Add(blocks[i].updateLocation.ToXYZ());
                    data.Add(blocks[i].updateRotation.ToXYZ());
                    data.Add(blocks[i].blockType.ToString());
                    selectPlayer.SendDataPackage(data);
                }
                break;

            case "getSelf":
                data.Add("updateSelfLocation");
                data.Add(selectPlayer.Location.ToXYZ());
                data.Add(selectPlayer.Rotation.ToCameraRotation().ToXYZ());
                selectPlayer.SendDataPackage(data);
                break;

            case "inited":
                selectPlayer.HasRecvInited = true;
                Logger.WriteLine(selectPlayer.Name + "已经完成初始化");
                selectPlayer.OnInited();
                break;

            case "throwItem":
                if (selectPlayer.IsDead)
                {
                    return;
                }
                thrownOutItems.ThrowFromPlayer(int.Parse(msgs[1]), new Vector3(msgs[2]), selectPlayer);
                break;

            case "pickupItem":
                if (selectPlayer.IsDead)
                {
                    return;
                }
                thrownOutItems.PickUpFromPlayer(selectPlayer, int.Parse(msgs[1]));
                break;

            case "updateThrownItems":
                thrownOutItems.SendToNewPlayer(selectPlayer);
                break;

            case "getHealth":
                data.Add("updateSelfHealth");
                data.Add(selectPlayer.Health.ToString());
                selectPlayer.SendDataPackage(data);
                break;

            case "respawn":
                if (selectPlayer.IsDead)
                {
                    selectPlayer.Health = RespawnOnDeadHealth;
                    data.Add("respawnCallback");
                    data.Add(true.ToString());
                    data.Add(RespawnOnDeadHealth.ToString());
                    data.Add(RespawnPoint.ToXYZ());
                    data.Add(RespawnEuler.ToXYZ());
                    selectPlayer.SendDataPackage(data);
                    List <string> dataToAll = new List <string>();
                    dataToAll.Add("playerRespawn");
                    dataToAll.Add(selectPlayer.Name);
                    SendAll(dataToAll);
                }
                else
                {
                    data.Add("respawnCallback");
                    data.Add(true.ToString());
                    data.Add(RespawnOnDeadHealth.ToString());
                    data.Add(RespawnPoint.ToXYZ());
                    data.Add(RespawnEuler.ToXYZ());
                    selectPlayer.SendDataPackage(data);
                }
                break;

            case "useItemEx":
                if (selectPlayer.IsDead)
                {
                    return;
                }
                ItemUsage.Invoke(int.Parse(msgs[1]), selectPlayer);
                break;

            case "startBomb":
                if (selectPlayer.MapContext == null)
                {
                    return;
                }
                selectPlayer.MapContext.ThrowItems.RecvBombData(int.Parse(msgs[1]), new Vector3(msgs[2]));
                break;

            case "changeThrownItemLctn":
                thrownOutItems.ChangeItemLocation(int.Parse(msgs[1]), new Vector3(msgs[2]));
                break;

            case "removeBlock":
            {
                for (int i = 0; i < blocks.Count; i++)
                {
                    if (blocks[i].blockId == msgs[1])
                    {
                        data.Add("removeBlock");
                        data.Add(blocks[i].blockId);
                        blocks.RemoveAt(i);
                        SendAll(data);
                    }
                }
            }
            break;

            case "buyItem":
            {
                int    staticId     = int.Parse(msgs[1]);
                string desc         = Base64Decode(msgs[2]);
                string extra        = Base64Decode(msgs[3]);
                int    cost         = int.Parse(msgs[4]);
                bool   isPayInXCoin = bool.Parse(msgs[5]);
                int    idc          = selectPlayer.BuyItem(staticId, desc, extra, cost, isPayInXCoin);
                data.Add("buyItemCallback");
                data.Add(idc.ToString());
                selectPlayer.ReplaceData(data);
                selectPlayer.SendXCoinAndBPData();
            }
            break;

            case "morebp":
            {
                int xcoin = int.Parse(msgs[1]);
                int bp    = int.Parse(msgs[2]);
                int idc   = selectPlayer.XCoinToBP(xcoin, bp);
                data.Add("morebpCallback");
                data.Add(idc.ToString());
                selectPlayer.ReplaceData(data);
                selectPlayer.SendXCoinAndBPData();
            }
            break;

            case "updateNewPlayerHelpStep":
            {
                int m = int.Parse(msgs[1]);
                if (selectPlayer.NewPlayerStep != -1)
                {
                    if (m == -1)
                    {
                        selectPlayer.BP += 1000;
                        selectPlayer.SendChat("你完成了新手引导任务,获得1000金币", "Forgetive");
                    }
                }
                selectPlayer.NewPlayerStep = m;
            }
            break;

            case "updateNPCState":
            {
                for (int i = 1; i < msgs.Length; i++)
                {
                    NPCManager.RecvDataFromHost(new NPCHostToServerData(msgs[i]), selectPlayer);
                }
            }
            break;

            case "damageNPC":
            {
                NPCManager.Attack(int.Parse(msgs[1]), float.Parse(msgs[2]), selectPlayer);
            }
            break;

            default:
                ExecutionContent.clicmd.Call(selectPlayer, msgs);
                break;
            }
            data.Clear();
        }
Esempio n. 23
0
        public static ItemComponent CreateNewItem(MessageProvider messageProvider, GameState state,
            string name, string imageLocation, string description,
            string modelPath, Vector2i size, Vector3 offset, Quaternion rotation, Shape shape, ItemLocation location,
            AttackClass attackClasses, ItemUsage itemUsages, Protection protection, Material physicsMaterial,
            float mass, float healthDelta, float usageDeltaPerUsage, float attackStrength, float throwPower, float usage)
        {
            var entity = EntityFactory.Instance.CreateWith(name, messageProvider,
                systems: new[] { typeof(ItemSystem), typeof(ModelSystem), typeof(PhysicsSystem) });

            var item = entity.GetComponent<ItemComponent>();
            item.ImageLocation = imageLocation;
            item.Description = description;
            item.Size = size;
            item.Location = location;
            item.AttackClasses = attackClasses;
            item.ItemUsages = itemUsages;
            item.Protection = protection;
            item.HealthDelta = healthDelta;
            item.AttackStrength = attackStrength;
            item.ThrowPower = throwPower;
            item.Usage = usage;
            item.UsageDeltaPerUsage = usageDeltaPerUsage;
            item.Mass = mass;
            item.PhysicsMaterial = physicsMaterial;
            item.PositionOffset = offset;
            item.Rotation = rotation;
            item.ItemUsageHandler = new MazeItemUseHandler();

            var model = new ModelSceneObject(modelPath);
            model.Enabled = true;
            state.Scene.AddObject(model);
            entity.GetComponent<ModelComponent>().Model = model;

            var transform = entity.GetComponent<TransformComponent>();
            var physics = entity.GetComponent<PhysicsComponent> ();

            if (shape == null)
            {
                List<JVector> vertices = new List<JVector>();
                model.Model.Meshes[0].Vertices.ForEach(x => vertices.Add(x.ToJitterVector()));

                List<TriangleVertexIndices> indices = new List<TriangleVertexIndices>();

                for(int i = 0; i < model.Model.Meshes[0].Indices.Length; i+= 3)
                {
                    int i0 = model.Model.Meshes[0].Indices[i+0];
                    int i1 = model.Model.Meshes[0].Indices[i+1];
                    int i2 = model.Model.Meshes[0].Indices[i+2];

                    indices.Add(new TriangleVertexIndices(i0, i1, i2));
                }

                shape = new TriangleMeshShape(new Octree(vertices, indices));
            }

            var body = new RigidBody(shape);
            body.Position = transform.Position.ToJitterVector ();
            if (mass >= 0)
                body.Mass = mass;
            body.Material = physicsMaterial;
            body.AllowDeactivation = true;
            body.Tag = entity;

            state.PhysicsManager.World.AddBody(body);
            physics.RigidBody = body;
            physics.World = state.PhysicsManager.World;
            physics.PhysicsApplying = AffectedByPhysics.Orientation | AffectedByPhysics.Position;
            physics.RigidBody.IsStatic = false;
            physics.RigidBody.IsActive = false;
            physics.RigidBody.Position = transform.Position.ToJitterVector();
            model.Position = transform.Position;

            return item;
        }
Esempio n. 24
0
    public void ItemMove()
    {
        ItemUsage  Item   = ItemUsage.GetComponent <ItemUsage> ();
        GameObject item   = GameObject.Find("ItemMove");
        Item       Script = item.GetComponent <Item> ();
        Attacks    Attack = Attacks.GetComponent <Attacks> ();

//		if(Script.OnItemMenu){
//			if (Input.GetAxis("Submit") > 0) {
//
//			}
//		}
//

        if (Script.OnItemMenu)
        {
            if (Input.GetAxisRaw("Cancel") == 1)
            {
                ItemExit();

                Script.OnItemMenu = false;
            }
            if (Input.GetAxisRaw("Horizontal") == 0 && Input.GetAxisRaw("Vertical") == 0)
            {
                KeyPressed = false;
            }



            if (Input.GetAxisRaw("Horizontal") == 1)
            {
                if (Item.IsItem1 && Item.IsItem2 && Item.IsItem3 || Item.IsItem4 && Item.IsItem2 && Item.IsItem3 || Item.IsItem1 && Item.IsItem3 && Item.IsItem4 || Item.IsItem1 && Item.IsItem2 && Item.IsItem4)
                {
                }
                else
                {
                    if (gameObject.transform.position == Pos1.transform.position)
                    {
                        if (Script.NOfClicks > 1)
                        {
                            if (KeyPressed == false)
                            {
                                gameObject.transform.position = Pos3.transform.position;
                                SelectFX.Play();
                                HeartPos = 3;
                            }
                        }
                    }
                    else if (gameObject.transform.position == Pos2.transform.position)
                    {
                        if (Item.IsItem1 == false && Item.IsItem2 == false && Item.IsItem3 == false && Item.IsItem4 == false)
                        {
                            gameObject.transform.position = Pos4.transform.position;
                            SelectFX.Play();
                            HeartPos = 4;
                        }
                    }
                }
            }
            else if (Input.GetAxisRaw("Horizontal") == -1)
            {
                if (gameObject.transform.position == Pos3.transform.position)
                {
                    gameObject.transform.position = Pos1.transform.position;
                    SelectFX.Play();
                    HeartPos = 1;
                }
                else if (gameObject.transform.position == Pos4.transform.position)
                {
                    gameObject.transform.position = Pos2.transform.position;
                    SelectFX.Play();
                    HeartPos = 2;
                }
//				else if (gameObject.transform.position == Pos1.transform.position){//I HAVE TO FIX THIS NEEDS FIX THIS NEEDS TO BE FIXED.
                //					gameObject.transform.position = Pos3.transform.position;//I HAVE TO FIX THIS NEEDS FIX THIS NEEDS TO BE FIXED.
                //					SelectFX.Play ();//I HAVE TO FIX THIS NEEDS FIX THIS NEEDS TO BE FIXED.
                //					HeartPos = 3;//I HAVE TO FIX THIS NEEDS FIX THIS NEEDS TO BE FIXED.
                //				}//I HAVE TO FIX THIS NEEDS FIX THIS NEEDS TO BE FIXED.
            }
            else if (Input.GetAxisRaw("Vertical") == -1)
            {
                if (Item.IsItem1 && Item.IsItem2 && Item.IsItem3 || Item.IsItem4 && Item.IsItem2 && Item.IsItem3 || Item.IsItem1 && Item.IsItem3 && Item.IsItem4 || Item.IsItem1 && Item.IsItem2 && Item.IsItem4 || Item.IsItem1 && Item.IsItem2 || Item.IsItem3 && Item.IsItem4 || Item.IsItem1 && Item.IsItem4 || Item.IsItem3 && Item.IsItem1)
                {
                }
                else
                {
                    if (gameObject.transform.position == Pos1.transform.position)
                    {
                        if (Script.NOfClicks > 1)
                        {
                            if (KeyPressed == false)
                            {
                                gameObject.transform.position = Pos2.transform.position;
                                SelectFX.Play();
                                HeartPos = 2;
                            }
                        }
                    }
                }


                if (gameObject.transform.position == Pos3.transform.position)
                {
                    if (Item.IsItem1 == false && Item.IsItem2 == false && Item.IsItem3 == false && Item.IsItem4 == false)
                    {
                        gameObject.transform.position = Pos4.transform.position;
                        SelectFX.Play();
                        HeartPos = 4;
                    }
                }
            }
            else if (Input.GetAxis("Vertical") == 1)
            {
                if (gameObject.transform.position == Pos4.transform.position)
                {
                    SelectFX.Play();
                    gameObject.transform.position = Pos3.transform.position;
                    HeartPos = 3;
                }
                else if (gameObject.transform.position == Pos2.transform.position)
                {
                    gameObject.transform.position = Pos1.transform.position;
                    SelectFX.Play();
                    HeartPos = 1;
                }
            }
        }
    }
        private void Btn_ItemUsageMod_Click(object sender, RoutedEventArgs e)
        {
            InventoryManagementWindow invWindow = new InventoryManagementWindow(VM.InventoryManager);

            invWindow.ShowDialog();

            if (invWindow.DialogResult == true)
            {
                foreach (InventoryItem item in VM.InventoryManager.InventoryUsage)
                {
                    ItemUsage usage = Procedure.InventoryUsage.SingleOrDefault(i => i.ItemId == item.Id);

                    if (usage == null)
                    {
                        usage = new ItemUsage(0, item.Id, item.Name, item.Quantity, item.Unit);
                        Procedure.InventoryUsage.Add(usage);
                    }
                    else
                    {
                        usage.Quantity += item.Quantity;
                    }
                }

                VM.InventoryManager.InventoryUsage.Clear();
                ListBox_InventoryUsage.Items.Refresh();
            }
        }
Esempio n. 26
0
        static void Main(string[] args)
        {
            __InitExceptionEventer();

            #region 主要环境初始化和硬件检查
            StartTime               = DateTime.Now;
            Console.Title           = "XCWorld Server - Forgetive";
            ItemStorage.OpenedFiles = new List <FileStream>();
            if (args.Length != 0)
            {
                Data.InitData(args[0]);
            }
            else
            {
                return;
            }
            Logger.Init();

#if !__LINUX_ARM
            CheckHardware();
#endif

            #endregion

            #region 参数处理
            if (args.Length == 1)
            {
            }
            else if (args.Length == 2)
            {
#if DEBUG
                sudoExecutionContent = args[1];
                isDebugMode          = true;
                Logger.WriteLine(LogLevel.Info, "已启用Debug模式");
#else
                Logger.WriteLine(LogLevel.Error, "正式版不允许手动设置权限");
                return;
#endif
            }
            else
            {
                Logger.WriteLine(LogLevel.Error, "仅允许添加一个具有完全权限执行体的名称");
                return;
            }

#if DEBUG
            Logger.WriteLine(LogLevel.Warning, "Forgetive Server SDK版");
            Logger.WriteLine(LogLevel.Warning, "测试版支持对应版本的 Forgetive Developer For Win10 客户端");
#endif
            if (!Environment.Is64BitProcess)
            {
                Logger.WriteLine(LogLevel.Error, "Forgetive Server 运行在32位进程下,进程仅允许最高1.5GB内存,这将导致不可恢复的错误。");
            }
            #endregion

            Logger.WriteLine("Forgetive Server 初始化网络...");

            key_device         = Data.GetTable("key", "device");
            key_banned         = Data.GetTable("key", "banned");
            key_nick           = Data.GetTable("key", "nick");
            nick_xcoin         = Data.GetTable("nick", "xcoin");
            nick_bp            = Data.GetTable("nick", "bp");
            nick_isop          = Data.GetTable("nick", "isop");
            nick_newplayerstep = Data.GetTable("nick", "newplayerstep");

            ForgetiveServer.Init();
            ItemUsage.Init();
            ItemStorage.Init();
            ServerVersion.Init();
            engine = new CommandEngine();

            assemblies = new List <Assembly>();
            assemblies.Add(Assembly.GetAssembly(typeof(Program)));
            assembliesMd5 = new List <string>();
            assembliesMd5.Add("INNEREXT");
            Logger.WriteLine(LogLevel.Info, "加载 Forgetive EXT {0}", "ForgetiveServer [Inner]");

            DirectoryInfo info = new DirectoryInfo(Data.RootPath + "/Extension");
            if (!info.Exists)
            {
                info.Create();
            }
            FileInfo[] files = info.GetFiles();
            for (int i = 0; i < files.Length; i++)
            {
                if (files[i].Extension == ".dll")
                {
                    try
                    {
                        assembliesMd5.Add(Hash(files[i].FullName));
                        Assembly assembly = Assembly.LoadFile(files[i].FullName);
                        assemblies.Add(assembly);
                    }
                    catch
                    {
                        Logger.WriteLine(LogLevel.Warning, "无法加载 {0} : 无效的 Forgetive EXT 文件", files[i].Name);
                        assembliesMd5.RemoveAt(assembliesMd5.Count - 1);
                    }
                    Logger.WriteLine(LogLevel.Info, "加载 Forgetive EXT {0}", files[i].Name);
                }
            }
            ExecutionContent.Load(assemblies.ToArray());

            List <Assembly> ass = new List <Assembly>(assemblies);
            ass.Add(Assembly.GetEntryAssembly());
            GlobalServer.Init(ass.ToArray());
            NPCManager.Init();

            TimeSpan total = DateTime.Now - StartTime;
            Logger.WriteLine(LogLevel.Default, "初始化完成({0}s),使用help查看指令列表", total.TotalSeconds);

            while (true)
            {
                string cmd = Console.ReadLine();
                engine.Execute(cmd);
            }
        }
Esempio n. 27
0
 public ItemUsageComboBoxItem(ItemUsage Usage)
 {
     this.Usage = Usage;
 }