Ejemplo n.º 1
0
 void Awake()
 {
     if (Instance != null && Instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
         DontDestroyOnLoad(gameObject);
         AddCubeConnectedAction(() => FadeAllLeds(CubeColor.black, 200));
     }
 }
Ejemplo n.º 2
0
        public static void CreateGluedJoycon()
        {
            Console.WriteLine("Applying some glue...");
            NintendoController leftJoycon    = null;
            NintendoController rightJoycon   = null;
            NintendoController proController = null;

            foreach (NintendoController controller in controllers)
            {
                HardwareInterface hardware = controller.GetHardware();
                hardware.SetReportMode(0x30); // 60hz update mode
                hardware.SetVibration(true);
                hardware.SetIMU(true);
                hardware.SetPlayerLights(PlayerLightState.Player1);
                HomeLEDInterface homeLED = controller.GetHomeLED();
                homeLED.SendPattern(HomeLEDInterface.GetHeartbeatPattern());

                switch (hardware.GetControllerType())
                {
                case ControllerType.LeftJoycon:
                    Console.WriteLine("Left Joycon detected.");
                    leftJoycon = controller;
                    break;

                case ControllerType.RightJoycon:
                    Console.WriteLine("Right Joycon detected.");
                    rightJoycon = controller;
                    break;

                case ControllerType.ProController:
                    Console.WriteLine("Pro Controller detected.");
                    proController = controller;
                    break;

                default:
                    Console.WriteLine("Unrecognized device.");
                    break;
                }
            }

            if (proController != null)
            {
                controller = proController.GetController().GetJoystick();
            }
            else
            {
                controller = leftJoycon.GetController().CombineWith(rightJoycon);
            }
        }
        static void Main(string[] args)
        {
            Factory factory = new Factory();

            SoftwareInterface os = factory.buildSoftware("OPERATING SYSTEM");

            os.createSoftware();

            SoftwareInterface drivers = factory.buildSoftware("DRIVERS");

            drivers.createSoftware();

            HardwareInterface motherboard = factory.buildHardware("MOTHERBOARD");

            motherboard.createCircuit();

            HardwareInterface microchip = factory.buildHardware("MICROCHIP");

            microchip.createCircuit();
        }
Ejemplo n.º 4
0
 public override void run()
 {
     if (Core.money < animationMoney)
     {
         animationMoney -= HardwareInterface.deltaTime * 1000;
         if (Core.money > animationMoney)
         {
             animationMoney = Core.money;
         }
     }
     if (Core.money > animationMoney)
     {
         animationMoney += HardwareInterface.deltaTime * 1000;
         if (Core.money < animationMoney)
         {
             animationMoney = Core.money;
         }
     }
     if (getA() && !a)
     {
         HardwareInterface.f5();
     }
 }
Ejemplo n.º 5
0
        private async void page_Loaded(object sender, RoutedEventArgs e)
        {
            await HardwareInterface.Initialize();

            DisplayCmd("Double click any item in here to read its content");
            DisplayCmd("Go to 'File -> Profiles' to load a profile!");
            DisplayCmd("If you're new, go to the store and download one!");
            try
            {
                if (sender != null && e != null)
                {
                    await Task.Run(async() =>
                    {
                        var builder = new StringBuilder();
                        foreach (var script in Directory.GetFiles("Scripts\\"))
                        {
                            var info       = new FileInfo(script);
                            var localHash  = info.CreationTimeUtc.ToString(CultureInfo.InvariantCulture);
                            var scriptName = Path.GetFileName(script);
                            string remoteHash;
                            try
                            {
                                remoteHash = await Kernel.Channel.GetScriptHashAsync(scriptName, "");
                            }
                            catch
                            {
                                continue;
                            }
                            var localTime  = DateTime.Parse(localHash);
                            var remoteTime = DateTime.Parse(remoteHash);

                            if (localTime >= remoteTime)
                            {
                                continue;
                            }

                            builder.AppendLine("New version of '" + scriptName + "' available in the store!");
                            if (!Directory.Exists(@"Cache\Store\"))
                            {
                                continue;
                            }
                            if (File.Exists(@"Cache\Store\" + scriptName?.Replace(".cs", ".badge")))
                            {
                                File.Delete(@"Cache\Store\" + scriptName?.Replace(".cs", ".badge"));
                            }
                            if (File.Exists(@"Cache\Store\" + scriptName?.Replace(".cs", ".header")))
                            {
                                File.Delete(@"Cache\Store\" + scriptName?.Replace(".cs", ".header"));
                            }
                        }
                        if (!string.IsNullOrEmpty(builder.ToString()))
                        {
                            MessageBox.Show(builder.ToString());
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("VOTC Master Server offline. No updates could be fetched :(");
                IoQueue.Add(ex);
            }
            InternalSpeechRecognizer.PrepareSpeech();
            if (string.IsNullOrEmpty(Kernel.FacebookAccessToken))
            {
                return;
            }
            try
            {
                Kernel.FacebookClient = new FacebookClient(Kernel.FacebookAccessToken);
                dynamic friendsTaskResult = await Kernel.FacebookClient.GetTaskAsync("/me");

                Kernel.FacebookName = friendsTaskResult.first_name + " " + friendsTaskResult.last_name;
                dynamic facebookImage = await Kernel.FacebookClient.GetTaskAsync("/me/picture?redirect=0&height=200&type=normal&width=200");

                Kernel.ProfilePicture = facebookImage["data"].url;
                Kernel.UI.LoadImage();
            }
            catch
            {
                //Ignored
            }
        }
Ejemplo n.º 6
0
 public Settings(HardwareInterface h)
     : base(h)
 {
 }
Ejemplo n.º 7
0
 public Phone(HardwareInterface h)
     : base(h)
 {
 }
Ejemplo n.º 8
0
 public Music(HardwareInterface h)
     : base(h)
 {
 }
Ejemplo n.º 9
0
 public Messenger(HardwareInterface h)
     : base(h)
 {
 }
Ejemplo n.º 10
0
 public Maps(HardwareInterface h)
     : base(h)
 {
 }
Ejemplo n.º 11
0
 public ContactBook(HardwareInterface h)
     : base(h)
 {
 }
Ejemplo n.º 12
0
 public Camera(HardwareInterface h)
     : base(h)
 {
 }
Ejemplo n.º 13
0
 public App(HardwareInterface h)
 {
     hardware = h;
 }
Ejemplo n.º 14
0
        public Form1()
        {
            mKeyProgrammer = new KeyProgrammer(ref KeyMaps);
            SpecialKeyPlayer.InitPlayer();

            notifyIcon1                   = new System.Windows.Forms.NotifyIcon();
            notifyIcon1.Icon              = this.Icon;
            notifyIcon1.Text              = "DX1 Utility";
            notifyIcon1.MouseDoubleClick += new MouseEventHandler(notifyIcon1_MouseDoubleClick);
            notifyIcon1.Visible           = true;

            InitializeComponent();

            mDX1Hardware = new HardwareInterface();
            mDevHandle   = mDX1Hardware.OpenDevice(true);

            mDX1Hardware.RegisterWindowForEvents(mDevHandle, Handle);

            macroTimer.AutoReset = false;
            macroTimer.Elapsed  += new System.Timers.ElapsedEventHandler(macroTimer_Elapsed);

            RebuildMacroList();
            ControlBox = true;

            //Add the (Create new Profile) option to the Profile Combobox
            V_Profiles.Items.Add(DefCreateProf);

            //Create the Quick-Menu for Right-Click on NotifyIcon
            ContextMenu ContextMenu1 = new ContextMenu();
            MenuItem    ProfileMenu  = new MenuItem();

            ProfileMenu.Text       = "Profiles";
            ProfileMenu.RadioCheck = true;
            MenuItem ProfileSub;

            //Check for DX1Profiles folder if it doesn't exist, create it
            if (!System.IO.Directory.Exists(Globals.ProfileSavePath))
            {
                System.IO.Directory.CreateDirectory(Globals.ProfileSavePath);
            }

            //Load Profile List
            ProfileList = (List <Profiles>)LoadProfiles(Globals.ProfileSavePath + "Dx1Profiles.dat");

            //Add list of profiles to V_Profiles Combo Box and Context Menu
            foreach (Profiles Profile in ProfileList)
            {
                V_Profiles.Items.Add(Profile.ProfName);

                ProfileSub = new MenuItem();
                if (Profile.QuickMenu & Profile.ProfEnabled)
                {
                    ProfileSub.Text       = Profile.ProfName;
                    ProfileSub.RadioCheck = true;
                    ProfileSub.Click     += new EventHandler(ProfileSelected);
                    ProfileMenu.MenuItems.Add(ProfileSub);
                }
            }
            V_Profiles.Sorted = true;

            //AutoSelect Global Profile
            //If one doesn't exist create it (For users that have run 1.1 or earlier)
            if (!V_Profiles.Items.Contains(DefGlobalProf))
            {
                //No Global Profile, Create it
                InitKeyMap(ref KeyMaps);
                CurrentProfile          = new Profiles();
                CurrentProfile.ProfName = DefGlobalProf;
                ProfileList.Add(CurrentProfile);
                SaveButtonstoProfile(CurrentProfile.ProfName);
                SaveProfiles();
            }
            SelectGlobalProfile();


            //Initialize the DataGrid and KeyMap List
            G_KeyMap.AutoGenerateColumns      = false;
            G_KeyMap.DataSource               = KeyMaps;
            G_KeyMap.AllowUserToResizeRows    = false;
            G_KeyMap.AllowUserToResizeColumns = false;
            //G_KeyMap.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            //G_KeyMap.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;


            //Add Dx1Key Column
            DataGridViewTextBoxColumn DxColumn = new DataGridViewTextBoxColumn();

            DxColumn.Width                      = 30;
            DxColumn.DataPropertyName           = "Dx1Key";
            DxColumn.HeaderText                 = "Key";
            DxColumn.ReadOnly                   = true;
            DxColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            G_KeyMap.Columns.Add(DxColumn);

            //Add Description Column
            DataGridViewTextBoxColumn DescColumn = new DataGridViewTextBoxColumn();

            DescColumn.Width            = 120;
            DescColumn.DataPropertyName = "Description";
            DescColumn.HeaderText       = "Description";
            DescColumn.ReadOnly         = true;
            G_KeyMap.Columns.Add(DescColumn);


            //Finialize Quick-Menu Options for the Notify Icon
            ProfileMenu.Popup += new EventHandler(QuickMenuPopup);
            ContextMenu1.MenuItems.Add(ProfileMenu);
            ContextMenu1.MenuItems.Add("-");
            ContextMenu1.MenuItems.Add("O&pen", new EventHandler(notifyIcon1_MouseDoubleClick));
            ContextMenu1.MenuItems.Add("E&xit", new EventHandler(CloseApp));

            notifyIcon1.ContextMenu = ContextMenu1;

            appFocusCheckTimer.AutoReset = true;
            appFocusCheckTimer.Interval  = 1000;
            appFocusCheckTimer.Elapsed  += new System.Timers.ElapsedEventHandler(appFocusCheckTimer_Elapsed);
            appFocusCheckTimer.Start();
        }
 public HardwareInterface GetHardware()
 {
     hardware = hardware ?? new HardwareInterface(this);
     return(hardware);
 }