Inheritance: MonoBehaviour
 public void AddMovesPlayer(ButtonController button)
 {
     Debug.Log ("GameController: " + button.name);
     playerMoves.Add (button);
     if (!CheckMove ()) {
         //play game over sound
         audioSource.PlayOneShot (failure);
         Debug.Log ("invalid");
         buttons[0].canClick = false;
         buttons[1].canClick = false;
         buttons[2].canClick = false;
         buttons[3].canClick = false;
         gameOver = true;
         gameOverText.enabled = true;
         return;
     } else {
         //play button sound
         audioSource.PlayOneShot(button.clip);
     }
     // at end of pattern list, reset lists and add to pattern
     if (playerMoves.Count == pattern.Count) {
         updateScores();
         playerMoves = new List<ButtonController>();
         StartCoroutine(AddAndDisplayPattern());
     }
 }
Esempio n. 2
0
 void Start()
 {
     this.TimeMeter.maxValue = Timer;    // メーターの最大値の設定
     this.TimeMeter.value    = 0;        // デンモクの制限時間の設定
     this.button             = GetComponent <ButtonController>();
 }
Esempio n. 3
0
	public void SetList(ButtonController _ctr, string s, bool isActive){

		if(GameController.Instance.mode == GameController.MODE.NEKO){
			int seNo = clearBtns.Count;
			if(clearBtns.Count >= 3){
				seNo = clearBtns.Count % 3;
			}
			Debug.Log("seNo:"+seNo);
			GameController.Instance.PlayCatClickSe(seNo);
		}else{
			int seNo = clearBtns.Count;
			if(clearBtns.Count >= 7){
				seNo = clearBtns.Count % 7;
			}
			Debug.Log("seNo:"+seNo);
			GameController.Instance.PlayClickSe(seNo);
		}

		foreach(GameObject obj in playerInputList){
			Destroy(obj);
		}
		playerInputList.Clear();

		if(isActive){
			clearBtns.Add(_ctr);
		}else{
			clearBtns.Remove(_ctr);
		}
		string m = "";
		foreach(ButtonController ctr in clearBtns){
			m += ctr._s;

			GameObject obj = (GameObject)GameObject.Instantiate(imagePref.gameObject);
			string pref = "Moji_";
			if(GameController.Instance.mode == GameController.MODE.NEKO){
				pref = "MojiN_";
			}
			obj.GetComponent<Image>().sprite = (Sprite)Resources.Load<Sprite>(pref+ctr._s);
			obj.transform.SetParent(playerInputRoot.transform);
			obj.SetActive(true);

			playerInputList.Add(obj);
		}
//		text.text = m;
	}
Esempio n. 4
0
 public void DisableButtons()
 {
     ButtonController.DisableButton();
 }
Esempio n. 5
0
 private void ProcessDrawingButtonClicked(ButtonController button)
 {
     drawingController.SetDrawing(currentGroup, button.Id);
     progressController.StartDrawing(currentGroup, button.Id);
     PlayGame();
 }
Esempio n. 6
0
 private void Start()
 {
     ps = GetComponent <PartSelection>();
     buttonController = buttonObject.GetComponent <ButtonController>();
 }
Esempio n. 7
0
        public Factory()
        {
            _skreenFactory = new UISkreenFactory();

            _buttonController = new ButtonController(_skreenFactory);
        }
Esempio n. 8
0
    public void InstantiateShelfUnit(int blx, int bly, bool isStatic, bool forward, bool grabbed)
    {
        //get an ID for our new shelf
        int id = getNewID();

        //make a stock button for the shelf
        GameObject stockButton = Instantiate(unitPrefabs.stockPrefab, new Vector3(-100, -100, -100), Quaternion.identity);


        //make out new shelf using the right prefab and get the appropriate movement component
        Vector3 shelfPos = new Vector3(
            Tile.getPos(blx, SHELFDIMENSIONS[0]), Tile.getPos(bly, SHELFDIMENSIONS[1]), 0);

        UnitBehaviour movement;
        GameObject    shelf;

        if (!isStatic)
        {
            shelf    = Instantiate(unitPrefabs.shelfPrefab, shelfPos, Quaternion.identity);
            movement = shelf.GetComponent <UnitMovement>();
        }
        else
        {
            shelf    = Instantiate(unitPrefabs.staticShelfPrefab, shelfPos, Quaternion.identity);
            movement = shelf.GetComponent <UnitStatic>();
        }


        //get the controller of the stock button
        ButtonController buttonController = stockButton.GetComponent <ButtonController>();


        //set all relevant parametres for this shelf
        movement.setId(id);
        movement.bleftx = blx;
        movement.blefty = bly;
        movement.myType = UnitInfo.unitType.SHELF;
        movement.setFloorLength(SHELFFLOORDIMENSIONS[0], SHELFFLOORDIMENSIONS[1]);
        movement.setSize(SHELFDIMENSIONS[0], SHELFDIMENSIONS[1]);
        movement.forward = forward;
        buttonController.setID(id);

        //give the movment it's stock button
        movement.giveStockButton(stockButton);

        //if it is grabbed we say the shelf is grabbed so it follows the cursor
        //otherwise we add it in the grid so it cannot be overriden
        if (grabbed)
        {
            movement.grab();
        }
        else
        {
            addUnit(
                blx, bly, id, SHELFFLOORDIMENSIONS[0], SHELFFLOORDIMENSIONS[1],
                forward, UnitInfo.unitType.SHELF);
        }

        //put this in the dictionary so it can later be destroyed? may be redunant and can just do this from object movement?
        units[id] = movement;
    }
Esempio n. 9
0
 private void buttonPrintInstalments_Click(object sender, EventArgs e)
 {
     ButtonController.startAnotherApplication(@"C:\Skrypty\Drukowanie instalmentow z wave.bat");
 }
Esempio n. 10
0
 private void buttonBlockCurierLabels_Click(object sender, EventArgs e)
 {
     ButtonController.startAnotherApplication(@"C:\Skrypty\BlokowanieEtykietKurierskich.cmd");
 }
Esempio n. 11
0
 private void buttonDeleteOrderOrSid_Click(object sender, EventArgs e)
 {
     ButtonController.startAnotherApplication(@"C:\Skrypty\Usprawnienie\Usprawnienie_prod.jar");
 }
Esempio n. 12
0
 private void Awake()
 {
     instance = this;
 }
Esempio n. 13
0
 void Start()
 {
     Instance = this;
 }
Esempio n. 14
0
 private void Awake()
 {
     //get id from parent
     parent   = GetComponentInParent <ButtonController>();
     buttonId = parent.buttonId;
 }
Esempio n. 15
0
 void Start()
 {
     instance = this;
 }
        /// <summary>
        /// Initialize a new instance of the KryptonButton class.
        /// </summary>
        public KryptonCommandLinkButton()
        {
            // We generate click events manually, suppress default
            // production of them by the base Control class
            SetStyle(ControlStyles.StandardClick |
                     ControlStyles.StandardDoubleClick, false);

            // Set default button properties
            base.AutoSize = false;
            DialogResult  = DialogResult.None;
            _orientation  = VisualOrientation.Top;
            _useMnemonic  = true;

            // Create content storage
            CommandLinkImageValue = new ImageValue(NeedPaintDelegate);
            CommandLinkTextValues = new CommandLinkTextValues(NeedPaintDelegate);

            // Create the palette storage
            StateCommon = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonCommand, PaletteBorderStyle.ButtonCommand, PaletteContentStyle.ButtonCommand, NeedPaintDelegate);
            PaletteContentText contentShortText = StateCommon.Content.ShortText;

            contentShortText.Font              = new Font(@"Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 0);
            contentShortText.TextH             = PaletteRelativeAlign.Near;
            contentShortText.TextV             = PaletteRelativeAlign.Center;
            StateCommon.Content.LongText.TextH = PaletteRelativeAlign.Near;
            StateCommon.Content.LongText.TextV = PaletteRelativeAlign.Far;

            StateDisabled                     = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StateNormal                       = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StateTracking                     = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StatePressed                      = new PaletteTriple(StateCommon, NeedPaintDelegate);
            OverrideDefault                   = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonCommand, PaletteBorderStyle.ButtonCommand, PaletteContentStyle.ButtonCommand, NeedPaintDelegate);
            OverrideFocus                     = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonCommand, PaletteBorderStyle.ButtonCommand, PaletteContentStyle.ButtonCommand, NeedPaintDelegate);
            OverrideFocus.Border.Draw         = InheritBool.True;
            OverrideFocus.Border.DrawBorders  = PaletteDrawBorders.All;
            OverrideFocus.Border.GraphicsHint = PaletteGraphicsHint.AntiAlias;
            // Force style update
            ButtonStyle = ButtonStyle.Command;

            // Create the override handling classes
            _overrideFocus    = new PaletteTripleOverride(OverrideFocus, StateNormal, PaletteState.FocusOverride);
            _overrideNormal   = new PaletteTripleOverride(OverrideDefault, _overrideFocus, PaletteState.NormalDefaultOverride);
            _overrideTracking = new PaletteTripleOverride(OverrideFocus, StateTracking, PaletteState.FocusOverride);
            _overridePressed  = new PaletteTripleOverride(OverrideFocus, StatePressed, PaletteState.FocusOverride);

            // Create the view button instance
            drawButton = new ViewDrawCommandLinkButton(StateDisabled,
                                                       _overrideNormal,
                                                       _overrideTracking,
                                                       _overridePressed,
                                                       new PaletteMetricRedirect(Redirector),
                                                       CommandLinkImageValue, CommandLinkTextValues,
                                                       Orientation,
                                                       UseMnemonic)
            {
                // Only draw a focus rectangle when focus cues are needed in the top level form
                TestForFocusCues = true
            };

            // Create a button controller to handle button style behaviour
            _buttonController = new ButtonController(drawButton, NeedPaintDelegate);

            // Assign the controller to the view element to treat as a button
            drawButton.MouseController  = _buttonController;
            drawButton.KeyController    = _buttonController;
            drawButton.SourceController = _buttonController;

            // Need to know when user clicks the button view or mouse selects it
            _buttonController.Click       += OnButtonClick;
            _buttonController.MouseSelect += OnButtonSelect;

            // Create the view manager instance
            ViewManager = new ViewManager(this, drawButton);
        }
Esempio n. 17
0
 private void buttonReprintLeaflet_Click(object sender, EventArgs e)
 {
     ButtonController.startAnotherApplication(@"C:\Jonit\wfd\smProd\si\prod-sm-InsertReprint.pl");
 }
 public void OnGameButtonClick(ButtonController button)
 {
     this.gameScore += (Mathf.RoundToInt((button.buttonScore * 1000) / 100) * 100);
     this.UpdateScoreLabel(gameScore);
 }
Esempio n. 19
0
 private void labelFileMaterialsNames_Click(object sender, EventArgs e)
 {
     ButtonController.startAnotherApplication(@"D:\Jonit_VAR\Prod\msgSM-X_Materials");
 }
Esempio n. 20
0
        /// <summary>
        /// Initialize a new instance of the KryptonButton class.
        /// </summary>
        public KryptonButton()
        {
            // We generate click events manually, suppress default
            // production of them by the base Control class
            SetStyle(ControlStyles.StandardClick |
                     ControlStyles.StandardDoubleClick, false);

            // Set default button properties
            _style       = ButtonStyle.Standalone;
            DialogResult = DialogResult.None;
            _orientation = VisualOrientation.Top;
            _useMnemonic = true;

            // Create content storage
            Values              = CreateButtonValues(NeedPaintDelegate);
            Values.TextChanged += OnButtonTextChanged;

            // Create the palette storage
            StateCommon     = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);
            StateDisabled   = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StateNormal     = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StateTracking   = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StatePressed    = new PaletteTriple(StateCommon, NeedPaintDelegate);
            OverrideDefault = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);
            OverrideFocus   = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);

            // Create the override handling classes
            _overrideFocus    = new PaletteTripleOverride(OverrideFocus, StateNormal, PaletteState.FocusOverride);
            _overrideNormal   = new PaletteTripleOverride(OverrideDefault, _overrideFocus, PaletteState.NormalDefaultOverride);
            _overrideTracking = new PaletteTripleOverride(OverrideFocus, StateTracking, PaletteState.FocusOverride);
            _overridePressed  = new PaletteTripleOverride(OverrideFocus, StatePressed, PaletteState.FocusOverride);

            // Create the view button instance
            _drawButton = new ViewDrawButton(StateDisabled,
                                             _overrideNormal,
                                             _overrideTracking,
                                             _overridePressed,
                                             new PaletteMetricRedirect(Redirector),
                                             this,
                                             Orientation,
                                             UseMnemonic)
            {
                // Only draw a focus rectangle when focus cues are needed in the top level form
                TestForFocusCues = true
            };

            // Create a button controller to handle button style behaviour
            _buttonController = new ButtonController(_drawButton, NeedPaintDelegate);

            // Assign the controller to the view element to treat as a button
            _drawButton.MouseController  = _buttonController;
            _drawButton.KeyController    = _buttonController;
            _drawButton.SourceController = _buttonController;

            // Need to know when user clicks the button view or mouse selects it
            _buttonController.Click       += OnButtonClick;
            _buttonController.MouseSelect += OnButtonSelect;

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawButton);

            _useAsDialogButton = false;

            _useAsUACElevationButton = false;
        }
Esempio n. 21
0
 private void Awake()
 {
     buttonController = FindObjectOfType <ButtonController>();
 }
Esempio n. 22
0
    void operatorControll(string mouseEvent, string mouseButton)
    {
        if (mouseEvent.Equals("up") && mouseButton.Equals("right"))
        {
            return;
        }
        else if (mouseEvent.Equals("up") && mouseButton.Equals("left"))
        {
            audioSources[1].Play();
        }
        else if (mouseEvent.Equals("down") && mouseButton.Equals("right"))
        {
            return;
        }
        else if (mouseEvent.Equals("down") && mouseButton.Equals("left"))
        {
            audioSources[0].Play();
            bool flag = sendAction(new Action(Performer.User, ObjectType.Operator, MotionType.Execute, getValue()), "");
            if (flag)
            {
                GameObject[]     parameters        = GameObject.FindGameObjectsWithTag("Operand");
                ButtonController return_controller = GameObject.FindGameObjectWithTag("Return").GetComponent <ButtonController>();
                int parameter_value1 = int.Parse(parameters[0].GetComponent <ButtonController>().getValue());
                int parameter_value2 = int.Parse(parameters[1].GetComponent <ButtonController>().getValue());
                switch (getValue())
                {
                case "+":
                    return_controller.setValue((parameter_value1 + parameter_value2).ToString());
                    break;

                case "-":
                    return_controller.setValue((parameter_value1 - parameter_value2).ToString());
                    break;

                case "*":
                    return_controller.setValue((parameter_value1 * parameter_value2).ToString());
                    break;

                case "/":
                    if (parameter_value2 == 0)
                    {
                        Debug.Log("Division by zero is not posible");
                    }
                    else
                    {
                        return_controller.setValue((parameter_value1 / parameter_value2).ToString());
                    }
                    break;

                case "%":
                    return_controller.setValue((parameter_value1 % parameter_value2).ToString());
                    break;

                case "**":
                    return_controller.setValue((parameter_value1 ^ parameter_value2).ToString());
                    break;

                case "==":
                    return_controller.setValue((parameter_value1 == parameter_value2).ToString());
                    break;

                case "!=":
                    return_controller.setValue((parameter_value1 != parameter_value2).ToString());
                    break;

                case "<":
                    return_controller.setValue((parameter_value1 < parameter_value2).ToString());
                    break;

                case "<=":
                    return_controller.setValue((parameter_value1 <= parameter_value2).ToString());
                    break;

                case ">":
                    return_controller.setValue((parameter_value1 > parameter_value2).ToString());
                    break;

                case ">=":
                    return_controller.setValue((parameter_value1 >= parameter_value2).ToString());
                    break;
                }
            }
        }
    }
 public void EnableTheButtons()
 {
     ButtonController.EnableButton();
 }
Esempio n. 24
0
 void Awake()
 {
     instance = this;
 }
Esempio n. 25
0
 void Awake()
 {
     ActionButton = GameObject.Find("ActionButton").GetComponent <ButtonController> ();
 }
Esempio n. 26
0
 void Start()
 {
     button = GameObject.Find("Canvas").transform.Find("ChildButtonController").GetComponent <ChildButtonController>();
 }
Esempio n. 27
0
    /**
     * Tries to insert a button for the corresponding obstacle.
     * <param name="shortestDistance">The shortest distance of the path after adding the obstacle.</param>
     * <param name="nodeAtObstacle">The node in front of the obstacle.</param>
     * <param name="optimalPathWithoutObstacle">The optimal path before adding the obstacle.</param>
     * <param name="buttonId">The id of the button.</param>
     * <param name="onPlayerPath">The location flag of the obstacle.</param>
     * <param name="obstacle">The corresponding obstacle.</param>
     * <returns>Whether the operation was successful.</returns>
     */
    private bool InsertButton(int shortestDistance, NodeController nodeAtObstacle, List <NodeController> optimalPathWithoutObstacle, int buttonId, bool onPlayerPath, EdgeController obstacle)
    {
        //Counts the number of tested nodes.
        int counter = 0;

        while (true)
        {
            //Breaks if it checked too much nodes. Chooses after that another obstacle.
            if (counter == MainScript.NumberOfNodes)
            {
                return(false);
            }

            //Gets a random node as button.
            NodeController node = GetRandomNode();
            //Checks the conditions of the node.
            if (optimalPathWithoutObstacle.Contains(node) || node.Button != -1)
            {
                continue;
            }
            //Sets the values of the new button.
            node.Button = buttonId;
            node.States = SetStates(buttonId);

            //Calculates the shortest distance after adding the button.
            GameObject algorithmObject = Instantiate(modifiedDijkstraAlgorithmPrefab);
            if (MainScript.CurrentLevelCount != -1)
            {
                MainScript.GarbageCollectorGameObjects.Add(algorithmObject);
            }
            ModifiedDijkstraAlgorithm algorithm = algorithmObject.GetComponent <ModifiedDijkstraAlgorithm>();
            if (onPlayerPath)
            {
                algorithm.Initialize(MainScript.AllNodes[playerStartPosition], MainScript.AllNodes[MainScript.NumberOfNodes - 1]);
            }
            else
            {
                algorithm.Initialize(MainScript.AllNodes[opponentStartPosition], MainScript.AllNodes[MainScript.Height - 1]);
            }
            algorithm.CalculateModifiedDijkstraAlgorithm();
            int newShortestDistance = algorithm.ShortestDistance;

            //Calculates the distance between button and obstacle.
            GameObject algorithmObject1 = Instantiate(modifiedDijkstraAlgorithmPrefab);
            if (MainScript.CurrentLevelCount != -1)
            {
                MainScript.GarbageCollectorGameObjects.Add(algorithmObject1);
            }
            ModifiedDijkstraAlgorithm algorithm1 = algorithmObject1.GetComponent <ModifiedDijkstraAlgorithm>();
            algorithm1.Initialize(node, nodeAtObstacle);
            algorithm1.CalculateModifiedDijkstraAlgorithm();
            int distanceBetweenButtonAndObstacle = algorithm1.ShortestDistance;

            //Checks the conditions.
            if (newShortestDistance < shortestDistance && distanceBetweenButtonAndObstacle > (shortestDistance / 10))
            {
                Destroy(algorithmObject);
                Destroy(algorithmObject1);
                //Adds the button at the choosen node.
                GameObject       gameObject = Instantiate(buttonPrefab, node.transform.position, Quaternion.identity);
                ButtonController button     = gameObject.GetComponent <ButtonController>();
                button.Initialize(obstacle, node, buttonId);
                MainScript.AllButtons.Add(button);
                button.gameObject.transform.localScale = new Vector3(0.25f * MainScript.ScaleMazeSize, 0.25f * MainScript.ScaleMazeSize);
                if (MainScript.CurrentLevelCount != -1)
                {
                    MainScript.GarbageCollectorGameObjects.Add(gameObject);
                }
                break;
            }
            //Resets the values and checks another node.
            Destroy(algorithmObject);
            Destroy(algorithmObject1);
            node.Button = -1;
            node.States = null;
            counter++;
        }
        return(true);
    }
    public void Update()
    {
        RaycastHit hit = new RaycastHit(); Physics.Raycast(pointerOrigin.position, transform.forward, out hit, Mathf.Infinity, pointerIgnore);

        if (hit.collider != null && held == null)
        {
            showPointer(hit);

            if (hit.collider.tag == "Button")
            {
                lastBut = hit.transform.parent.GetComponent <ButtonController>();
                lastBut.Hover();
            }
            else if (lastBut != null)
            {
                lastBut.UnHover();
                lastBut = null;
            }

            if (hit.transform.gameObject.layer == LayerMask.NameToLayer("Building"))
            {
                lastBui = hit.transform.GetComponent <BasicBuilding>();
                lastBui.Hover();
            }
            else if (lastBui != null)
            {
                lastBui.UnHover();
                lastBui = null;
            }
        }
        else
        {
            pointer.enabled = false;
            if (lastBut != null)
            {
                lastBut.UnHover();
                lastBut = null;
            }
            if (lastBui != null)
            {
                lastBui.UnHover();
                lastBui = null;
            }
        }

        if (held != null && !doGrab)
        {
            held.GetComponent <BasicAsset>().ChangeParent();
            bool drop = true;
            if (held.GetComponent <BasicThrown>().addColl != null)
            {
                drop = !held.GetComponent <BasicThrown>().addColl.GetComponent <BasicAsset>().TryAdd(held);
            }
            if (drop)
            {
                if (velocity > minSpinVelocity)
                {
                    Rigidbody rb = held.GetComponent <Rigidbody>();
                    rb.AddForce(dir * velocity);
                    rb.angularVelocity = dir * velocity;
                }
            }

            held.GetComponent <BasicThrown>().held = false;
            held = null;
        }
        else if (held != null)
        {
            held.transform.position = transform.position;
            held.transform.rotation = transform.rotation;
        }
    }
Esempio n. 29
0
 // Start is called before the first frame update
 void Start()
 {
     buttonController = GameObject.Find("ButtonController").GetComponent <ButtonController>();
 }
 /// <summary>
 /// Start is called on the frame when a script is enabled just before
 /// any of the Update methods is called the first time.
 /// </summary>
 void Start()
 {
     testButtonController = testObj.GetComponent <ButtonController>();
 }
    //Initialize variables, check the statuses of each panle and display the correct information
    void Start()
    {
        buttonController = GetComponentInChildren<ButtonController>();
        controlController = GetComponentInChildren<ControlsController>();
        CPU_Controls = 1;

        l.is_p1_active = true;

        carImage = transform.FindChild("CarImage").GetComponent<Image>();
        carImage.sprite = default_Empty;

        if   (!m.is_this_active) { carImage.sprite = default_notActive; }
        else { carImage.sprite = default_Empty; }

        switch (PanelNumber)
        {

            case 1:
                if (l.is_p1_active == true) { nameplayer = "1P"; Controls = 1; }
                break;

            case 2:
                nameplayer = "2P";
                break;

            case 3:
                nameplayer = "3P";
                break;

            case 4:
                nameplayer = "4P";
                break;
        }

        player_selector();

        if (m.is_this_active)
        {
            if      (m.ThisPlayerControl == MoveSelector.ControlTypesHere.Joy1)      { Control_Type.text = "Joy1"; ControlIcon.sprite = J1; }
            else if (m.ThisPlayerControl == MoveSelector.ControlTypesHere.Joy2)      { Control_Type.text = "Joy2"; ControlIcon.sprite = J2; }
            else if (m.ThisPlayerControl == MoveSelector.ControlTypesHere.ArrowKeys) { Control_Type.text = "ArrowKeys"; ControlIcon.sprite = ArrowK; }
            else if (m.ThisPlayerControl == MoveSelector.ControlTypesHere.WSDA)      { Control_Type.text = "WSDA"; ControlIcon.sprite = WASDIcon; }
            else                                                                     { Control_Type.text = "Not Assigned"; ControlIcon.sprite = NA; }
        }

        else { Control_Type.text = "Not Assigned"; ControlIcon.sprite = NA; }
    }
 private void Start()
 {
     buttonController = Resources.Load <ButtonController>("ObjButton");
 }
Esempio n. 33
0
        public async Task <StatusCodeResult> PostAsync()
        {
            RouteData route = ControllerContext.RouteData;

            if (route.Values.ContainsKey("state"))
            {
                var state  = route.Values.GetValueOrDefault("state") as String;
                var userId = state.Split('_')[0];
                var chatId = state.Split('_')[1];
                var user   = Bot.GetUserById(userId);

                string xml = "";
                using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
                {
                    xml = await reader.ReadToEndAsync();
                }

                YouTubeNotification notification;
                DateTime            published = new DateTime(DateTime.Now.Year - 1, DateTime.Now.Month, DateTime.Now.Day);
                try
                {
                    if (xml == "")
                    {
                        throw new Exception("Xml is empty");
                    }

                    notification = parseXml(xml);

                    // если уже отправляли - не отправляем еще раз
                    // если вышло время - удаляем
                    foreach (YouTubeNotification lastNotification in user.ChatsAndLastNotifications.GetValueOrDefault(chatId).ToList())
                    {
                        if (lastNotification.VideoId == notification.VideoId)
                        {
                            notification.AlreadySent = true;
                        }
                        if (lastNotification.OutdatedAt < DateTime.Now)
                        {
                            user.ChatsAndLastNotifications.GetValueOrDefault(chatId).Remove(lastNotification);
                        }
                    }

                    if (notification.IsNewVideo)
                    {
                        var  text = notification.ToMarkdownString();
                        long id;
                        long.TryParse(chatId, out id);
                        var markup = await ButtonController.GetMarkupAsync(id, notification.VideoId, true, "n");

                        await Bot.SendTextMessageAsync(id, text, Telegram.Bot.Types.Enums.ParseMode.Markdown, markup);

                        notification.OutdatedAt = DateTime.Now + TimeSpan.FromMinutes(10);
                        user.ChatsAndLastNotifications.GetValueOrDefault(chatId).Add(notification);
                    }
                }
                catch (Exception ex)
                {
                    //await Bot.SendDebugMessageAsync(ex.Message);
                    //await Bot.SendDebugMessageAsync(ex.StackTrace);
                    //await Bot.SendDebugMessageAsync(xml);
                }

                return(Ok());
            }

            await Bot.SendDebugMessageAsync("BadRequest at YouTubeUpdatesController.Post()");

            return(BadRequest());
        }
Esempio n. 34
0
 // Start is called before the first frame update
 void Start()
 {
     _buttonController = GameObject.Find("ButtonController").GetComponent <ButtonController>();
     _animator         = GetComponentInParent <Animator>();
 }
    // Use this for initialization
    void Start()
    {
        // Get some Gamestuff
        UIFoo = GameObject.Find("UI").GetComponent<UIController>();
        buttonController = GameObject.Find("ButtonController").GetComponent<ButtonController>();
        buttonController.SelectedBuilding.GetComponent<clickforhouseinfos>().OnMouseDown();

        // Time Initialize
        Day = 1; Week = 1; Month = 1; Year = 1; Hour = 1;
        lastDay = 1; lastWeek = 1; lastMonth = 1; lastYear = 1; lastHour = 0;
        UIFoo.Day_ = Day; UIFoo.Hour_ = Hour; UIFoo.Week_ = Week; UIFoo.Month_ = Month; UIFoo.Year_ = Year; UIFoo.Sacrifices_ = SacrificePoints;
        lastGameTime = Time.time;
        // Ressource initialization
        Food = 0;
        Satisfaction = 100;
        Wood = 0;
        SacrificePoints = 0;

        HumanPrefab.GetComponent<HumanController>().SetNewTarget(GameObject.Find("MainBuilding").GetComponent<Building>());

        for (int i = 0; i < 3; i++)
        {
            makeHuman();
        }
    }