Example #1
0
    // Use this for initialization
    void Start()
    {
        if (keyCodes == null)
        {
            keyCodes = (KeyCode[])System.Enum.GetValues(typeof(KeyCode));
        }
        var RH = (Equipment)Resources.Load("ProjectAssets/prefabs/RHand", typeof(Equipment));
        var LH = (Equipment)Resources.Load("ProjectAssets/prefabs/LHand", typeof(Equipment));

        //quickslots/equiptment
        equipmentHandler                = gameObject.AddComponent <EquipmentHandler>();
        equipmentHandler.RightHand      = rightHand;
        equipmentHandler.LeftHand       = leftHand;
        equipmentHandler.HandModelLeft  = LH;
        equipmentHandler.HandModelRight = RH;
        waitingOnEquip = false;
        //hud
        hud = gameObject.AddComponent <HUD>();
        hud.AddQuickItem(0, (Equipment)Resources.Load("ProjectAssets/prefabs/Flashlight", typeof(Equipment)));
        hud.AddQuickItem(1, (Equipment)Resources.Load("ProjectAssets/prefabs/SprayCan", typeof(Equipment)));
        hud.AddQuickItem(2, LH);
        hud.AddQuickItem(3, RH);
        hud.AddQuickItem(4, (Equipment)Resources.Load("ProjectAssets/prefabs/Aerosol_Can_2", typeof(Equipment)));
        //controllers
        _mouseLook      = gameObject.AddComponent <MouseLook> ();
        _characterMotor = gameObject.AddComponent <CharacterMotor> ();
        _fpsController  = gameObject.AddComponent <FPSInputController> ();
    }
Example #2
0
 // Use this for initialization
 void Start()
 {
     attackController   = GetComponent <AttackController>();
     equipmentHandler   = GetComponent <EquipmentHandler>();
     movementController = GetComponent <MovementController>();
     uicontroller       = GameObject.FindObjectOfType <UIController>() as UIController;
     health             = maxHealth;
 }
Example #3
0
 public Titan(ActorParameters parameters) : base(parameters, Swatch.DbBlood, (char)0x1054)
 {
     Equipment = new EquipmentHandler();
     Facing    = Direction.SE;
     _attacks  = new List <IAction>()
     {
         new DamageAction(50, new TargetZone(TargetShape.Range)),
         new DamageAction(50, new TargetZone(TargetShape.Range)),
         new DamageAction(100, new TargetZone(TargetShape.Self, 1, 2), 240, 240),
     };
     _current = 0;
 }
Example #4
0
            protected override void Awake()
            {
                base.Awake();
                Instance = this;

                _slots = GetComponentsInChildren <SlotHandler>();

                foreach (SlotHandler slotHandler in _slots)
                {
                    slotHandler.Refresh(null);
                }
            }
Example #5
0
    public override void OnStartLocalPlayer()
    {
        if (!isLocalPlayer)
        {
            return;
        }
        for (int i = 0; i < prefabsToRegister.Length; i++)
        {
            ClientScene.RegisterPrefab(prefabsToRegister [i]);
        }

        /*
         * ClientScene.RegisterPrefab((GameObject)Resources.Load("Prefabs/Enemy"));
         * ClientScene.RegisterPrefab((GameObject)Resources.Load("Particles/Hit"));
         * ClientScene.RegisterPrefab((GameObject)Resources.Load("Particles/ImpactOnGround"));
         * ClientScene.RegisterPrefab(skillPrefab);
         * ClientScene.RegisterPrefab(skillEffectPrefab);*/

        UICanvas = GameObject.Find("UI");

        this.movement = GetComponent <PlayerMovement>();

        this.skillUi = GameObject.Find("Actionbar_UI").GetComponent <SkillUIManager>();
        this.skillUi.init(this);

        this.skillManager = GetComponent <SkillManager>();
        this.skillManager.init(this, getSkillUiManager());

        //this.skillTreeUi = GameObject.Find(this.skillTreeUi.name)

        this.equip = Tools.getChild(UICanvas, "Equipment_UI").GetComponent <EquipmentHandler>();

        this.skillTreeUi = Tools.getChild(UICanvas, this.skillTreeUi.name);

        chat    = Tools.getChild(UICanvas, "Chat_UI").GetComponent <Chat>();
        network = GetComponent <playerNetwork>();
        network.initialize(this);
        chat.setPlayer(this);
        camera         = Camera.main;
        this.inventory = this.GetComponent <Inventory> ();
        this.inventory.init(this);

        camera.GetComponent <MainCamera> ().player = this.gameObject;
        camera.GetComponent <MainCamera> ().setState((int)e_cameraStates.DEFAULT);
    }
        public static void GetJson(EquipmentHandler equipRepo, OwnerHandler ownerRepo)
        {
            List <Mac>       Macs   = new List <Mac>();
            List <Owner>     Owners = new List <Owner>();
            List <Equipment> Equip  = new List <Equipment>();

            string json = File.ReadAllText(@"C:\Users\peter\source\repos\MDMScrape\MDMScrape\bin\Debug\netcoreapp2.1\Macs.json");

            Macs = JsonConvert.DeserializeObject <List <Mac> >(json);

            for (int i = 0; i < Macs.Count; i++)
            {
                Equip.Add(Macs[i]);
                Equip[Equip.Count - 1].EquipType = Equipment.EquipmentType.Mac;
                Owners.Add(Macs[i].Owner);
            }

            var eqpTasks   = new List <Task>();
            var ownerTasks = new List <Task>();

            var owner = Owners.Distinct().ToList();

            for (int i = 0; i < Equip.Count; i++)
            {
                equipRepo.Insert(Equip[i], false);
                if (i % 20 == 0)
                {
                    equipRepo.Save();
                }
            }

            for (int i = 0; i < owner.Count; i++)
            {
                ownerRepo.Insert(owner[i], false);

                if (i % 20 == 0)
                {
                    ownerRepo.Save();
                }
            }
        }
Example #7
0
        public void Start(Runtime runtime, PlayerControls playerControls)
        {
            var currentLocation  = new Location();
            var userInterface    = new UI();
            var map              = new Map();
            var wornEquipment    = new Worn();
            var equipmentHandler = new EquipmentHandler();

            NewGameReset.ResetGame(currentLocation);

            userInterface.ShownUserInterface(
                map,
                runtime,
                userInterface,
                currentLocation,
                playerControls,
                myLists.Environment,
                wornEquipment,
                equipmentHandler

                );
        }
 public HomeController(ManagementContext ctx, IStringLocalizerFactory factory) : base(factory)
 {
     ctx.Database.EnsureCreated();
     repo = new EquipmentHandler(ctx);
 }
        private static Command WithSetCommands(this Command parent)
        {
            var extCmd = BuildCommand("set", true)
                         .WithSubCommand("value", true, subCommand => {
                subCommand
                .WithHandler(CommandHandler.Create((long equipmentId, string url, string value) => EquipmentHandler.SetValue(equipmentId, url, value ?? string.Empty)))
                .WithOption <long>("--equipmentId", "equipment id", true)
                .WithOption <string>("--url", "varaible url", true)
                .WithOption <string>("--value", "value to set", false);
            });

            parent.AddCommand(extCmd);
            return(parent);
        }
Example #10
0
    //TODO:Slot myConnectedSlot;


    public void setEquipmentHandler(EquipmentHandler aWatcher)
    {
        myEquipmentHandler = aWatcher;
    }
Example #11
0
        public static void GetRandomTest(EquipmentHandler equipRepo, OwnerHandler ownerRepo)
        {
            var usersToAdd     = 500;
            var equipmentToAdd = 500;

            const string chars   = "abcdefghijklmnopqrstuvxyzw";
            const string numbers = "123456789";

            var random = new Random();

            var owners    = new List <Owner>();
            var equipment = new List <Equipment>();


            for (int i = 0; i < usersToAdd; i++)
            {
                var owner = new Owner();

                owner.FirstName = new string(Enumerable.Repeat(chars, 10)
                                             .Select(s => s[random.Next(s.Length)]).ToArray());

                owner.LastName = new string(Enumerable.Repeat(chars, 10)
                                            .Select(s => s[random.Next(s.Length)]).ToArray());

                owner.LastEdited = DateTime.Now;

                owners.Add(owner);
            }

            for (int i = 0; i < equipmentToAdd; i++)
            {
                var eqp = new Equipment();

                eqp.Serial = new string(Enumerable.Repeat(numbers, 15)
                                        .Select(s => s[random.Next(s.Length)]).ToArray());

                eqp.Model = new string(new string(Enumerable.Repeat(chars, 10)
                                                  .Select(s => s[random.Next(s.Length)]).ToArray()) +
                                       new string(Enumerable.Repeat(numbers, 8)
                                                  .Select(s => s[random.Next(s.Length)]).ToArray()));

                eqp.LastEdited = DateTime.Now;
                eqp.EquipType  = Equipment.EquipmentType.Laptop;

                equipment.Add(eqp);
            }


            for (int i = 0; i < equipment.Count; i++)
            {
                equipRepo.Insert(equipment[i], false);
                if (i % 20 == 0)
                {
                    equipRepo.Save();
                }
            }

            for (int i = 0; i < owners.Count; i++)
            {
                ownerRepo.Insert(owners[i], false);

                if (i % 20 == 0)
                {
                    ownerRepo.Save();
                }
            }
        }
        public void ShownUserInterface(Map map, Runtime runtime, UI userInterface, Location currentLocation, PlayerControls playerControls, List <IEnvironment> environments, Worn wornEquipment, EquipmentHandler equipmentHandler)
        {
            bool gameLoop = true;

            while (gameLoop)
            {
                runtime.ExitUpdater(currentLocation, runtime, currentLocation.CurrentRoomNumber);
                runtime.UpdateList(currentLocation.CurrentRoomNumber);
                map.ShowMap(currentLocation, environments);

                Console.WriteLine("━━━");
                Console.WriteLine(runtime.RoomDescription(map,
                                                          currentLocation,
                                                          currentLocation.CurrentRoomX,
                                                          currentLocation.CurrentRoomY,
                                                          currentLocation.CurrentRoomNumber,
                                                          runtime,
                                                          userInterface));

                Console.WriteLine("{0} HP - {1} Stamina. TNL: {2} Exits: {3}", Player.Health,
                                  Player.Moves,
                                  (Player.MaxExperience - Player.Experience),
                                  runtime.Exits);

                Console.WriteLine("X: {0} Y: {1}", currentLocation.CurrentRoomX,
                                  currentLocation.CurrentRoomY);
                Console.WriteLine("━━━");
                Console.Write("Command: ");

                runtime.Exits = "";
                playerControls.UserInput(userInterface,
                                         runtime,
                                         currentLocation, environments, wornEquipment, currentLocation.CurrentRoomNumber, equipmentHandler);

                Console.Clear();
            }
        }
 public CheckEquipmentAvailabilityCommand(Equipment equipment, List <Booking> bookings, ApplicationDbContext dbContext)
 {
     Equipment        = equipment;
     Bookings         = bookings;
     EquipmentHandler = new EquipmentHandler(dbContext);
 }
Example #14
0
 public EquipmentController(IUow uow, IEquipmentRepository repository, EquipmentHandler handler) : base(uow)
 {
     _uow        = uow;
     _repository = repository;
     _handler    = handler;
 }
Example #15
0
 public EquipmentsController(IEquipmentRepository repository)
 {
     _repository = repository;
     _handler    = new EquipmentHandler(_repository);
 }
Example #16
0
 public void InitializeEquipmentHandler()
 {
     myEquipmentHandler = new EquipmentHandler();
     myEquipmentHandler.SetItemHandler(this);
 }
 public GetAllEquipmentCommand(ApplicationDbContext dbContext)
 {
     EquipmentHandler = new EquipmentHandler(dbContext);
 }
Example #18
0
    public override void OnStartLocalPlayer()
    {
        if (!isLocalPlayer)
        {
            return;
        }
        commandManager = new CommandManager(this);
        for (int i = 0; i < prefabsToRegister.Length; i++)
        {
            ClientScene.RegisterPrefab(prefabsToRegister [i]);
        }
        ResourceStructure.initilize();

        /*
         * ClientScene.RegisterPrefab((GameObject)Resources.Load("Prefabs/Enemy"));
         * ClientScene.RegisterPrefab((GameObject)Resources.Load("Particles/Hit"));
         * ClientScene.RegisterPrefab((GameObject)Resources.Load("Particles/ImpactOnGround"));
         * ClientScene.RegisterPrefab(skillPrefab);
         * ClientScene.RegisterPrefab(skillEffectPrefab);*/
        //UI
        UICanvas      = GameObject.Find("UI");
        login         = Tools.findInactiveChild(UICanvas, "Login_UI").GetComponent <Login>();
        this.movement = GetComponent <PlayerMovement>();
        //skills
        this.skillUi = Tools.findInactiveChild(UICanvas, "Actionbar_UI").GetComponent <SkillUIManager>();
        this.skillUi.init(this);
        this.skillManager = GetComponent <SkillManager>();
        this.skillManager.init(this, getSkillUiManager());

        //this.skillTreeUi = GameObject.Find(this.skillTreeUi.name)

        //network
        network = GetComponent <playerNetwork>();
        network.initialize(this);

        this.skillTreeUi = Tools.getChild(UICanvas, this.skillTreeUi.name);

        //chat
        chat = Tools.getChild(UICanvas, "Chat_UI").GetComponent <Chat>();
        chat.setPlayer(this);

        //inventory
        this.inventory = this.GetComponent <Inventory> ();
        this.inventory.init(this);

        //equip
        equip = Tools.getChild(UICanvas, "Equipment_UI").GetComponent <EquipmentHandler>();
        equip.setEquipmentUI(Tools.getChild(UICanvas, "Equipment_UI"));
        equip.setPlayer(this);

        //camera
        camera = Camera.main;
        camera.GetComponent <MainCamera> ().player = this.gameObject;
        camera.GetComponent <MainCamera> ().setState((int)e_cameraStates.DEFAULT);

        //worlds
        worlds[0] = GameObject.Find("login_World");
        worlds[1] = GameObject.Find("World");


        //TempQuestUI
        GameObject tempQuestUI = Instantiate(this.quest_UI);

        this.questInformationData = tempQuestUI.GetComponentInChildren <QuestInformationData>();
        tempQuestUI.transform.SetParent(this.getUI().transform);
        tempQuestUI.transform.SetAsLastSibling();
        tempQuestUI.SetActive(false);
        questInformationObject = tempQuestUI;

        //QuestWrapper
        questWrapper = getUI().transform.GetChild(getUI().transform.childCount - 1).GetChild(1).GetChild(0).GetComponent <QuestWrapper>();

        //UIPlayer
        this.UIPlayer = Tools.findInactiveChild(UICanvas, "Footer_UI").GetComponent <UIPlayerHandler>();
        this.UIPlayer.setPlayer(this);
        this.UIPlayer.gameObject.SetActive(true);
        this.UIPlayer.updateInfo();

        this.UIActionBar = Tools.findInactiveChild(UICanvas, "Actionbar_UI");
        UIActionBar.SetActive(true);
        this.uiStats = Tools.findInactiveChild(UICanvas, "Stat_UI").GetComponent <UIStats>();
        uiStats.gameObject.SetActive(false);
        Debug.Log("STATS: " + this.stats.s_str);

        this.UIDeath = Tools.findInactiveChild(this.getUI(), "Death_UI");
        this.UIDeath.SetActive(true);
        this.UIDeath.GetComponent <GraveStone>().player = this;
        this.UIDeath.SetActive(false);

        //QuestManager
        this.npcController = GameObject.FindWithTag("NPCManager").GetComponent <NPCController>();
        npcController.initilize(this);

        identity = this.GetComponent <NetworkIdentity>();
        Debug.Log("INFO1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    }
 public EquipmentHandlerTests()
 {
     _handler = new EquipmentHandler(new EquipmentRepositoryMock());
 }