예제 #1
0
 void Start()
 {
     moveRawImage = (RawImage) moveObject.GetComponent<RawImage>();
     rotRawImage = (RawImage) rotObject.GetComponent<RawImage>();
     downRawImage = (RawImage) downObject.GetComponent<RawImage>();
     ci = new ControllerInterface (player, false);
 }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        m_camera = GetComponentInChildren <Camera>();

        controller = ControllerInterface.GetController(indexSoldier);
        Debug.Log("Received " + controller.name + "game controller");
        m_anim = transform.Find("soldier").animation;

        switch (colorType)
        {
        case ColorType.Bleu:
            mesh.renderer.material = materials[0];
            break;

        case ColorType.Rouge:
            mesh.renderer.material = materials[1];
            break;

        case ColorType.Vert:
            mesh.renderer.material = materials[2];
            break;

        case ColorType.Jaune:
            mesh.renderer.material = materials[3];
            break;
        }

        InitCamera();
    }
예제 #3
0
 public DJView(ControllerInterface controller, BeatModelInterface model)
 {
     this.controller = controller;
     this.model      = model;
     model.registerObserver((BeatObserver)this);
     model.registerObserver((BPMObserver)this);
 }
예제 #4
0
 public void SetGame(ControllerInterface game)
 {
     currentGame    = game;
     startTime      = Time.time;
     pauseStartTime = Time.time;
     started        = true;
 }
예제 #5
0
 void Start()
 {
     moveRawImage = (RawImage)moveObject.GetComponent <RawImage>();
     rotRawImage  = (RawImage)rotObject.GetComponent <RawImage>();
     downRawImage = (RawImage)downObject.GetComponent <RawImage>();
     ci           = new ControllerInterface(player, false);
 }
예제 #6
0
 void Awake()
 {
     if (ControllerInterface.Instance == null)
     {
         ControllerInterface = new ControllerInterface();
     }
     DontDestroyOnLoad(transform.gameObject);
 }
예제 #7
0
 public ControllerInterface()
 {
     Instance       = this;
     allControllers = new List <ControllerBase>();
     allControllers.Add(new ControllerBase("Keyboard1"));
     allControllers.Add(new ControllerBase("Keyboard2"));
     allControllers.Add(new ControllerBase("Keyboard3"));
     while (Input.GetJoystickNames().Length != instantiatedControllers)
     {
         UpdateInternal();
     }
 }
예제 #8
0
    // Update is called once per frame
    void Update()
    {
        if (m_enabled == false)
        {
            return;
        }

        if (ControllerInterface.GetKeyDown("start"))
        {
            m_enabled = false;
            ChangeScene();
        }
    }
예제 #9
0
        public ControllerSelectForm(string path, ControllerInterface @interface)
        {
            InitializeComponent();
            Device = path;
            Interface = @interface;
            this.cbControllerPath.Items.AddRange(ZWGlobal.GetAllUsedControllers().ToArray());

            cbControllerPath.TextChanged += (o, e) =>
                ChangeButtonsEnabled(false);

            cbType.SelectedIndexChanged += (o, e) =>
                ChangeButtonsEnabled(false);

            this.Load += (o, e) => PrepareConnection();
        }
예제 #10
0
        public bool ToggleControllerInterface()
        {
            enabledClassicJoystick = !enabledClassicJoystick;

            if (enabledClassicJoystick)
            {
                controllerInterface = new ClassicJoystick();
            }
            else
            {
                controllerInterface = new ModernController();
            }

            return(enabledClassicJoystick);
        }
        public ControlWindow(ControllerInterface controller)
        {
            serialCntrl = controller;
            InitializeComponent();

            fanDataObject = new FanControlDO(controller);
            this.DataContext = fanDataObject;

            ResponseCallback fanCallback = ListFans;
            serialCntrl.Request(1, fanCallback);

            // start Udp server
            udpServer = new FanUdpServer();
            udpServer.Run(fanDataObject);
        }
예제 #12
0
        public TargetNodeValueSelectForm(string device, ControllerInterface @interface, byte? nodeId, ulong? parameterId)
        {
            InitializeComponent();

            _device = device;
            _interface = @interface;
            _nodeID = nodeId;
            _valueId = parameterId;

            Refresh();

            btControllerSelect.Click += (o, e) =>
            {
                var form = new ControllerSelectForm(_device, _interface);
                form.HomeId = HomeId;
                if (form.ShowDialog() == DialogResult.OK)
                {
                    Device = form.Device;
                    Interface = form.Interface;
                    HomeId = form.HomeId;
                }
            };

            btNodeSelect.Click += (o, e) =>
            {
                var form = new NodeSelectForm(_device, _interface);
                if (this.NodeId != null)
                {
                    form.SelectedNode = ZWGlobal.GetNodeById(this.NodeId.Value);
                }
                if (form.ShowDialog() == DialogResult.OK)
                {
                    this.NodeId = form.SelectedNode.ID;
                }
            };

            btParameterSelect.Click += (o, e) =>
            {
                if (_nodeID != null)
                {
                    var form = new SelectNodeValueForm(ZWGlobal.GetNodeById(_nodeID.Value));
                    if (form.ShowDialog() == DialogResult.OK && form.SelectedValue != null)
                    {
                        ValueId = form.SelectedValue.GetId();
                    }
                }
            };
        }
예제 #13
0
        private void editNode(object sender, EventArgs e)
        {
            TreeNode selected = tree.SelectedNode;

            if (selected.Tag == null)
            {
                return;
            }

            if (selected.Tag is ControllerInterface)
            {
                ControllerInterface node = (ControllerInterface)selected.Tag;

                setCurrentEditor(node.createControl());
            }
        }
예제 #14
0
        private void GeometryTestForm_Load(object sender, EventArgs e)
        {
            drawingBox        = new DrawingBox();
            drawingBox.Anchor = AnchorStyles.Left;
            drawingBox.Size   = this.ClientSize;
            drawingBox.Paint += DrawingBox_Paint;
            this.Controls.Add(drawingBox);

            intesectDrawController = new IntersectDrawController(drawingBox);
            intesectDrawController.Test();

            pointInPolygonController = new PointInPolygonController(drawingBox);
            pointInPolygonController.Test();

            pointRelationPosController = new PointRelationPosController(drawingBox);
            pointRelationPosController.Test();
        }
예제 #15
0
    void Start()
    {
        ENABLE_WIIMOTE = Wiimote.enableWiiMote ();

        // Initialize wiimote receiver
        // TODO(Douglas): Make this work for multiple controllers (if needed)
        ci = ControllerInterface.Instance;
        if (ENABLE_WIIMOTE) {
            receiver = WiimoteReceiver.Instance;
            receiver.connect ();
            while (true) {
                if (receiver.wiimotes.ContainsKey (1)) {
                    ci.setController (1, receiver.wiimotes [1]);
                    break;
                }
            }
        }
    }
예제 #16
0
 public NodeSelectForm(string device, ControllerInterface @interface)
 {
     InitializeComponent();
     ColumnsInitialize();
     dataGrid.CellMouseDown += (o, e) =>
     {
         if (e.RowIndex >= 0) //dataGrid crutch
             dataGrid.Rows[e.RowIndex].Selected = true;
     };
     dataGrid.SelectionChanged += (o, e) =>
     {
         btOk.Enabled = dataGrid.SelectedRows.Count > 0;
     };
     dataGrid.CellDoubleClick += (o, e) =>
     {
         this.DialogResult = DialogResult.OK;
     };
     SetControllerToFindNodes(device, @interface);
 }
예제 #17
0
    void Start()
    {
        ENABLE_WIIMOTE = Wiimote.enableWiiMote();

        // Initialize wiimote receiver
        // TODO(Douglas): Make this work for multiple controllers (if needed)
        ci = ControllerInterface.Instance;
        if (ENABLE_WIIMOTE)
        {
            receiver = WiimoteReceiver.Instance;
            receiver.connect();
            while (true)
            {
                if (receiver.wiimotes.ContainsKey(1))
                {
                    ci.setController(1, receiver.wiimotes [1]);
                    break;
                }
            }
        }
    }
예제 #18
0
        public Form1()
        {
            InitializeComponent();
            //
            //Exception handler
            //
            ConcreteExceptionHandlerInitializer.initThisExceptionHandler(
                ExceptionHandler.Concrete.ExceptionHandler.getInstance());
            //
            //MVC
            //
            ModelInterface model = new Model();

            view       = new Basic.View(this, model);
            controller = new Controller(model);
            //настройка переключателя
            tabControl1.Appearance    = TabAppearance.FlatButtons;
            tabControl1.ItemSize      = new Size(0, 1);
            tabControl1.SizeMode      = TabSizeMode.Fixed;
            tabControl1.TabStop       = false;
            tabControl1.SelectedIndex = 7;
            radioButton1.Checked      = true;
            textBox5.Visible          = false;
            label25.Visible           = false;
            button24.Visible          = false;
            radioButton3.Checked      = true;
            checkBox2.Checked         = true;
            button6.Enabled           = false;
            button28.Enabled          = false;
            //добавление колонок в таблицу
            DataGridViewTextBoxColumn coefficient0;

            coefficient0            = new DataGridViewTextBoxColumn();
            coefficient0.Width      = 363;
            coefficient0.HeaderText = "Пути к логам";
            dataGridView1.Columns.Add(coefficient0);
        }
 public RunCommand(string key, string description, ControllerInterface contr) : base(key, description)
 {
     this.contr = contr;
 }
 public ControllerInterface GetController()
 {
     controller = controller ?? new ControllerInterface(this);
     return(controller);
 }
예제 #21
0
 public FanControlDO(ControllerInterface cntrl)
 {
     serialCntrl = cntrl;
     pinMap = new Dictionary<int, byte>();
     fanSpeed = new Dictionary<int, byte>();
 }
예제 #22
0
    void UpdateSelector()
    {
        //First pass
        if (m_selector == -1)
        {
            m_selector = 0;
        }

        if (ControllerInterface.GetKeyDown("right"))
        {
            m_selector++;
            lockSelectionTimer += lockSelectionDelay;
        }
        else if (ControllerInterface.GetKeyDown("left"))
        {
            m_selector--;
            lockSelectionTimer += lockSelectionDelay;
        }
        else if (ControllerInterface.GetKeyDown("down"))
        {
            foreach (VirtualSelector selector in m_currentSelectables)
            {
                selector.DownAction();
            }
            lockSelectionTimer += lockSelectionDelay;
            if (m_selector == 2)
            {
                m_playersCounter--;
                m_playersCounter = Mathf.Clamp(m_playersCounter, 2, 4);
                PlayersText.text = m_playersCounter.ToString();
            }
        }
        else if (ControllerInterface.GetKeyDown("up"))
        {
            foreach (VirtualSelector selector in m_currentSelectables)
            {
                selector.UpAction();
            }
            lockSelectionTimer += lockSelectionDelay;
            if (m_selector == 2)
            {
                m_playersCounter++;
                m_playersCounter = Mathf.Clamp(m_playersCounter, 2, 4);
                PlayersText.text = m_playersCounter.ToString();
            }
        }
        else if (ControllerInterface.GetKeyDown("validate"))
        {
            if (m_selector == 3)
            {
                StartGame();
            }
            lockSelectionTimer += lockSelectionDelay;
        }

        if (m_selector > m_maxSelectables)
        {
            m_selector = 0;
        }

        if (m_selector < 0)
        {
            m_selector = m_maxSelectables;
        }
    }
예제 #23
0
 private void SetControllerToFindNodes(string path, ControllerInterface @interface)
 {
     var zwave = ZWGlobal.PrepareZWave(path, @interface);
     if (zwave.WaitForControllerLoaded())
     {
         _zwave = zwave;
         RefreshData();
     }
     else
     {
         this.dataGrid.DataSource = null;
         MessageBox.Show("Время ожидания отклика от контроллера истекло.");
     }
 }
예제 #24
0
파일: Helper.cs 프로젝트: noant/Pyrite
 public static void PrepareController(string path, ControllerInterface @interface)
 {
     if (!string.IsNullOrEmpty(path))
         ZWGlobal.PrepareZWave(path, @interface).WaitForControllerLoaded();
 }