コード例 #1
0
ファイル: UnitTests.cs プロジェクト: hirogaru/Inventory56
        public void EquipIndexTest()
        {
            EquipController controller = new EquipController();
            ViewResult      view       = controller.Index();

            Assert.AreEqual("", view.ViewName); //проверяем по имени результата
        }
コード例 #2
0
    void GrabGrip(GameObject grip)
    {
        EquipController eQ = grip.GetComponentInParent <EquipController>();

        eQ.gripController = this.gameObject;
        eQ.isGripped      = true;
    }
コード例 #3
0
    // Start is called before the first frame update
    protected void Start()
    {
        base.Start();
        if (gameController == null)
        {
            gameController = GameObject.Find("GameController").GetComponent <GameController>();
        }
        defaultBulletSprtite = Resources.Load <Sprite>("bullet/hammer");
        bulletJoint          = this.GetComponent <FixedJoint2D>();

        ClothSprite = this.FindChildObject("ClothSprite").GetComponent <EquipController>();
        FaceSprite  = this.FindChildObject("FaceSprite").GetComponent <EquipController>();
        HairSprite  = this.FindChildObject("HairSprite").GetComponent <EquipController>();
        ArmSprite   = this.FindChildObject("ArmSprite").GetComponent <EquipController>();

        if (staticBullet == null)
        {
            staticBullet = this.FindChildObject("StaticBullet");
        }

        anim = transform.GetChild(1).gameObject.GetComponent <Animator>();
        if (info != null)
        {
            if (info.direction > 180)
            {
                this.RotateLiving();
            }
        }
    }
コード例 #4
0
    void GrabWeapon(GameObject weapon)
    {
        EquipController eQ = weapon.GetComponentInParent <EquipController>();

        eQ.mainHandController = this.gameObject;
        eQ.isEquipped         = true;
        eQ.isGripped          = false;
        eQ.gripController     = null;
    }
コード例 #5
0
    public void ReleaseGrip(GameObject grip)
    {
        Debug.Log("Releasing Grip");
        EquipController eQ = grip.GetComponentInParent <EquipController>();

        eQ.gripController    = null;
        eQ.isGripped         = false;
        currentGrabbedObject = null;
    }
コード例 #6
0
    // Use this for initialization
    void Start()
    {
        stat = GameObject.Find("MenuControllers").GetComponent <StatusMenuController>();
        eq   = GameObject.Find("ItemControllers").GetComponent <EquipController>();
        gameObject.transform.SetParent(invPanel.transform, false);
        Button theBtn = gameObject.GetComponent <Button>();

        theBtn.onClick.AddListener(SendToUse);
    }
コード例 #7
0
ファイル: UnitTests.cs プロジェクト: hirogaru/Inventory56
        public void EquipListTest()
        {
            EquipController controller = new EquipController();
            ViewResult      result     = controller.EquipList(page: 1, sorted: 2, searchString: "бор", itemsPerPage: 50);

            Assert.AreEqual("", result.ViewName);      //проверяем по имени результата
            Assert.AreEqual(2, result.ViewBag.Sorted); //проверяем вьюбэг
            Assert.AreEqual("бор", result.ViewBag.Search);
            Assert.AreEqual(50, result.ViewBag.ItemsPage);
            Assert.IsInstanceOfType(result.ViewData.Model, typeof(PageableData <Item>)); //проверяем по типу модели
        }
コード例 #8
0
ファイル: UnitTests.cs プロジェクト: hirogaru/Inventory56
        public void EquipItemRedirectTest()
        {
            EquipController controller = new EquipController();
            Guid            ItemID     = Guid.NewGuid();
            ActionResult    result     = controller.EquipItem(ItemID);

            Assert.IsInstanceOfType(result, typeof(RedirectToRouteResult));//проверяем, результ это перенаправление?

            RedirectToRouteResult redirect = result as RedirectToRouteResult;

            Assert.AreEqual(redirect.RouteValues["action"], "EquipList"); //проверяем, куда перенаправили
        }
コード例 #9
0
ファイル: UnitTests.cs プロジェクト: hirogaru/Inventory56
        public void Equip4UserList()
        {
            EquipController controller = new EquipController();
            ActionResult    result     = controller.UserEquipList(default(Guid));

            Assert.IsInstanceOfType(result, typeof(PartialViewResult)); //проверяем, результ - партиал?

            PartialViewResult view = result as PartialViewResult;

            Assert.AreEqual("", view.ViewName);                                              //проверяем по имени результата
            Assert.IsInstanceOfType(view.ViewData.Model, typeof(List <EquipListViewModel>)); //проверяем по типу модели
        }
コード例 #10
0
ファイル: UnitTests.cs プロジェクト: hirogaru/Inventory56
        public void EquipItemViewTest()
        {
            EquipController controller = new EquipController();
            Guid            ItemID     = Guid.Parse("14444444-4444-4444-4444-444444444444");
            ActionResult    result     = controller.EquipItem(ItemID);

            Assert.IsInstanceOfType(result, typeof(ViewResult)); //проверяем, результ это вью?

            ViewResult view = result as ViewResult;

            Assert.AreEqual("", view.ViewName);                         //проверяем по имени результата
            Assert.IsInstanceOfType(view.ViewData.Model, typeof(Item)); //проверяем по типу модели
        }
コード例 #11
0
ファイル: Main.cs プロジェクト: Marcus101RR/PvPController
        /// <summary>
        /// Initializes a new player object when someone joins
        /// </summary>
        /// <param name="args"></param>
        private void ServerJoin(JoinEventArgs args)
        {
            Players[args.Who]        = new Player(TShock.Players[args.Who], this);
            Players[args.Who].IsDead = true;

            for (int i = 0; i < (int)(NetItem.ArmorSlots / 2); i++)
            {
                if (Players[args.Who].TPlayer.armor[i].netID != 0 &&
                    EquipController.ShouldPreventEquip(Players[args.Who], Players[args.Who].TPlayer.armor[i], 59 + i))
                {
                    Players[args.Who].TPlayer.armor[i].SetDefaults(0);
                }
            }
        }
コード例 #12
0
ファイル: Inventory.cs プロジェクト: code-games/skumrim
    public void Init(Unit owner = null, EquipController equips = null)
    {
        this.owner  = owner;
        this.equips = equips;

        encumbrance = 0;
        if (owner)
        {
            carryingCapacity = owner.stats.carryingCapacity;
        }

        items = new List <ItemStack>();
        loadStartingItems();
    }
コード例 #13
0
        /// <summary>
        /// Prevents prefixes on armor items
        /// </summary>
        /// <param name="args">The GetDataHandlerArgs object containing the player who sent the packet and the
        /// data in it</param>
        /// <returns>Whether or not the packet was handled (and should therefore not be processed
        /// by anything else)</returns>
        private bool HandleInventoryUpdate(GetDataHandlerArgs args)
        {
            args.Data.ReadByte();
            int slotId = args.Data.ReadByte();

            args.Data.ReadInt16();
            byte prefix = (byte)args.Data.ReadByte();
            int  netId  = args.Data.ReadInt16();

            // Is prefixed armor armor
            if (Controller.Config.BanPrefixedArmor && prefix > 0 && slotId >= 59 && slotId <= 61)
            {
                Item fixedArmorItem = new Item();
                fixedArmorItem.Prefix(0);
                fixedArmorItem.stack = 1;
                Controller.DataSender.SendSlotUpdate(args.Player, slotId, fixedArmorItem);
            }

            bool impossibleEquip = false;

            if (Controller.Config.PreventImpossibleEquipment && netId != 0)
            {
                if (slotId >= 59 && slotId <= 66)
                {
                    Item newEquip = new Item();
                    newEquip.SetDefaults(netId);
                    newEquip.Prefix(prefix);
                    if (EquipController.ShouldPreventEquip(args.Player, newEquip, slotId))
                    {
                        impossibleEquip = true;
                        args.Player.TPlayer.armor[slotId - 59].SetDefaults(0);
                    }
                }
            }
            return(impossibleEquip);
        }
コード例 #14
0
 private void Start()
 {
     equipController = transform.GetComponent <EquipController>();
     unitSelector    = transform.GetComponent <UnitSelector>();
 }
コード例 #15
0
 private void Start()
 {
     firePoint       = transform.Find("FirePoint").gameObject;
     equipController = transform.GetComponent <EquipController>();
 }
コード例 #16
0
ファイル: Unit.cs プロジェクト: code-games/skumrim
 public virtual void Awake()
 {
     stats = new Stats(this, startingStats);
     levelingController = new UnitLevelingController();
     equipments         = GetComponent <EquipController>();
 }
コード例 #17
0
 // Use this for initialization
 void Start()
 {
     party = GameObject.Find("PlayerParty").GetComponent <PartyController>();
     eq    = GameObject.Find("ItemControllers").GetComponent <EquipController>();
     main  = GameObject.Find("MenuControllers").GetComponent <MainMenuController>();
 }