Example #1
0
        public override void Load()
        {
            sprBackground            = Content.Load <Texture2D>("Triple Thunder/HUD/Menus/Weapon Selection/Background");
            sprExtraWeaponBackground = Content.Load <Texture2D>("Triple Thunder/HUD/Menus/Weapon Selection/Extra Weapon Background");
            sprNumber = Content.Load <Texture2D>("Triple Thunder/HUD/Menus/Weapon Selection/Number");

            WeaponOutlineButton = new AnimatedSprite(Content, "Triple Thunder/HUD/Menus/Weapon Selection/Weapon Button Outline", new Vector2(0, 0), 0, 1, 4);
            WeaponOutlineButton.SetFrame(2);

            ListDefaultWeapon.Add(new WeaponSelectionItem("AK-47"));
            ListDefaultWeapon.Add(new WeaponSelectionItem("Ingram MAC 10"));
            ListDefaultWeapon.Add(new WeaponSelectionItem("Scout"));
            ListDefaultWeapon.Add(new WeaponSelectionItem("M3"));
            ListDefaultWeapon.Add(new WeaponSelectionItem("M79"));
            ListDefaultWeapon.Add(new WeaponSelectionItem("MG42"));

            SelectedWeapon = ListDefaultWeapon[0];

            foreach (WeaponSelectionItem ActiveWeapon in ListDefaultWeapon)
            {
                ActiveWeapon.Load(Content);
            }

            foreach (WeaponMenuEquipment ActiveWeapon in Owner.Equipment.ArrayEquipedPrimaryWeapon)
            {
                ListPersonalWeapon.Add(new WeaponSelectionItem(ActiveWeapon.Name));
            }

            foreach (WeaponSelectionItem ActiveWeapon in ListPersonalWeapon)
            {
                ActiveWeapon.Load(Content);
            }
        }
Example #2
0
    public void OnClick()
    {
        int level = WeaponDB.Instance.GetWeaponLvById((int)weaponType);

        if (level == 0)
        {
            return;
        }

        if (!selected && IsCloseWeapon && dlg != null && dlg.HasCloseWeaponSelected())         // 只能选择一把近战武器
        {
            return;
        }
        if (!selected && dlg.SelectedGunWeaponCount() >= 4 && !IsCloseWeapon)
        {
            return;
        }

        //		if (!selected && GameData.Instance.selectedWeapons.Count == 0 && !IsCloseWeapon) return;

        selected = !selected;

        if (GetComponentInParent <TutorialDialog>() != null)
        {
            Debug.Log("??????????????");
            TutorialDialog td = GetComponentInParent <TutorialDialog>();
            parent = td.Param.target.GetComponent <WeaponSelectionItem>();
            parent.OnClick();
            return;
        }

        if (parent != null)
        {
            parent.selected = selected;
        }
        if (dlg != null)
        {
            dlg.OnSelectedWeaponsChanged();
        }

        if (selected)
        {
            icon.color = new Color(0.3f, 0.3f, 0.3f);
        }
        else
        {
            icon.color = Color.white;
            if (parent != null)
            {
                parent.icon.color = Color.white;
            }
        }
    }
Example #3
0
        public override void Update(GameTime gameTime)
        {
            if (KeyboardHelper.KeyPressed(Keys.Escape))
            {
                RemoveScreen(this);
            }

            if (MouseHelper.InputLeftButtonPressed())
            {
                float X     = Constants.Width / 2 - sprBackground.Width / 2;
                float DrawX = X + 68;
                float DrawY = 133;

                foreach (WeaponSelectionItem ActiveWeapon in ListDefaultWeapon)
                {
                    if (IsMouseOverItem(DrawX, DrawY))
                    {
                        SelectedWeapon = ActiveWeapon;
                    }
                    else
                    {
                        ActiveWeapon.IsSelected = false;
                    }

                    DrawY += 61;
                }

                DrawX = X + 268;
                DrawY = 133;
                foreach (WeaponSelectionItem ActiveWeapon in ListPersonalWeapon)
                {
                    if (IsMouseOverItem(DrawX, DrawY))
                    {
                        SelectedWeapon = ActiveWeapon;
                    }
                    else
                    {
                        ActiveWeapon.IsSelected = false;
                    }

                    DrawY += 61;
                }

                SelectedWeapon.IsSelected            = true;
                Owner.Equipment.EquipedPrimaryWeapon = SelectedWeapon.WeaponName;
            }
        }
Example #4
0
    public void OpenLoadOut(int slot)
    {
        ActiveSlot = slot;
        ActiveSlot = Mathf.Clamp(ActiveSlot, 1, 3);
        transform.parent.GetComponent <RectTransform>().DOLocalMoveY(1770, 0.75f);


        return;

        AvailableWindow.SetActive(true);
        DestroyChild(gridParent.gameObject);
        foreach (Weapon wpn in AvailableWeapons)
        {
            GameObject          Go  = Instantiate(weaponItem, gridParent);
            WeaponSelectionItem itm = Go.GetComponent <WeaponSelectionItem>();
            itm.currentWeapon = wpn;
            itm.Assign();
        }
    }