Example #1
0
    public void ValidateField(InputField inputfield)
    {
        Debug.Log("validate field:"+inputfield.name);
        Text icon = GameObject.Find (inputfield.name + "_check").GetComponent<Text> ();
        bool nameCheck = false;
        if(inputfield.name == "p_name") {
            if(!nameIsAvailable) {
                nameCheck = true;
            } else {
                nameCheck = false;
            }
        }
        if (inputfield.text == "" || nameCheck) {
            Errors = true;
            if(!nameCheck) {
                changeInputColor (inputfield, error_color);
                inputfield.text = getErrorMessage(inputfield.name);
            }
            // Hide succes icon if visibile
            if (icon.enabled) {
                icon.enabled = false;
            }
        } else {

            if (inputfield.text != getErrorMessage (inputfield.name)) {
                changeInputColor (inputfield, succes_color);
                // Show succes icon
                icon.enabled = true;
            }

        }
    }
    public void UpdatehighScore(InputField newChallenger)
    {
        GameControl gameManager = GameObject.Find ("GameControl").GetComponent<GameControl> ();
        SqlManager sqlManager = GameObject.Find ("GameControl").GetComponent<SqlManager> ();

        StartCoroutine(sqlManager.UpdateBuildingScore(gameManager.getId().ToString(), gameManager.getBestScore ().ToString(), newChallenger.text));
    }
    protected virtual void Awake()
    {
        // Call the base class's function to initialize all variables
        base.Awake();

        // Find all UI elements in the scene
        PB_MenuTitle = GameObject.Find("PB_MenuTitle").GetComponent<Text>();
        PB_TimeLeftText = GameObject.Find("PB_TimeLeftText").GetComponent<Text>();
        PB_PassPhoneButton = GameObject.Find("PB_PassPhoneButton").GetComponent<Button>();
        PB_HintField = GameObject.Find("PB_HintField").GetComponent<InputField>();
        PB_HintField2 = GameObject.Find("PB_HintField2").GetComponent<InputField>();
        PB_HintField3 = GameObject.Find("PB_HintField3").GetComponent<InputField>();
        PB_InsertHints = GameObject.Find("PB_InsertHints").GetComponent<Button>();
        PB_HideHints = GameObject.Find("PB_HideHints").GetComponent<Button>();
        PB_PlantBomb = GameObject.Find("PB_PlantBomb").GetComponent<Button>();
		PB_Waiting = GameObject.Find ("PB_Waiting").GetComponent<Text>();
        PB_ArmTimeLeftText = GameObject.Find("PB_ArmTimeLeftText").GetComponent<Text>();
        PB_ReplantBomb = GameObject.Find("PB_ReplantBomb").GetComponent<Button>();
        PB_TutorialPlant = GameObject.Find("PB_TutorialPlant").GetComponent<Button>();
        PB_TutorialReplant = GameObject.Find("PB_TutorialReplant").GetComponent<Button>();
        PB_TutorialHints = GameObject.Find("PB_TutorialHints").GetComponent<Button>();
        PB_GiveUp = GameObject.Find ("PB_GiveUp").GetComponent<Button>();

        userDefinedTargetHandler = GameObject.Find("UserDefinedTargetBuilder").GetComponent<UserDefinedTargetEventHandler>();
    }
	/*=========================== Methods ===================================================*/

	/*=========================== Awake() ===================================================*/

	void Awake(){

		// initialise variables

		lbPanelWidth = Screen.width * 0.28f; 	// width is 28% screen size
		lbPanelHeight = Screen.height * 0.72f; 	// height is 72% screen height

		// get reference to UI Elements
		usernameInput = GameObject.Find ("UsernameInputField").GetComponent<InputField>();
		playButton = GameObject.Find ("PlayButton").GetComponent<Button> ();
		leaderboardButton = GameObject.Find ("LeaderboardButton").GetComponent<Button>();
		quitButton = GameObject.Find ("QuitButton").GetComponent<Button>();

		// add play game button onclick method
		playButton.onClick.AddListener(() => PlayGame());

		// add leaderboard button onclick method
		leaderboardButton.onClick.AddListener(() => Leaderboard());

		// add quit button onclick method
		quitButton.onClick.AddListener(() => QuitGame());

		// get reference to saveManager
		saveManager = GetComponent<SaveGameDataManager>();

		// get reference to leaderboard
		leaderBoard = GetComponent<LeaderBoard>();

	} // Awake()
Example #5
0
        void Start()
        {
            chatText = GameObject.Find("Chat text").GetComponent<Text>();
            chatInput = GameObject.Find("Chat input").GetComponent<InputField>();

            playerInput = GetComponent<PlayerInput>();
        }
    private void Start()
    {
        m_Transition = GetComponent<ShowAndHidePanel>();
        m_AudioSource = GetComponent<AudioSource>();
        m_CanvasGroup = GetComponent<CanvasGroup>();
        m_CanvasGroup.alpha = 0;

        m_FaderPanel = transform.GetChild(0).GetComponent<RectTransform>();
        m_UserPanel = transform.GetChild(1).GetComponent<RectTransform>();

        m_NameInputValue = m_UserPanel.GetChild(1).GetChild(0).GetComponent<InputField>();
        m_EmailInputValue = m_UserPanel.GetChild(1).GetChild(1).GetComponent<InputField>();
        m_PasswordInputValue = m_UserPanel.GetChild(1).GetChild(2).GetComponent<InputField>();

        m_CancelButton = m_UserPanel.GetChild(2).GetComponent<Button>();
        m_CancelButton.onClick.RemoveAllListeners();
        m_CancelButton.onClick.AddListener(delegate { Cancel(); });

        m_RegisterButton = m_UserPanel.GetChild(3).GetComponent<Button>();
        m_RegisterButton.onClick.RemoveAllListeners();
        m_RegisterButton.onClick.AddListener(delegate { Register(); });

        m_FaderPanel.gameObject.SetActive(false);
        m_UserPanel.gameObject.SetActive(false);
    }
Example #7
0
 void Start()
 {
     input = this.transform.GetChild(0).gameObject.GetComponent<InputField>();
     transform.parent = GameObject.Find("Canvas").transform;
     EventSystem.current.SetSelectedGameObject(input.gameObject);
     Board.master.currentTextChanger = this;
 }
Example #8
0
    public void activateMainGame()
    {
        if (firstScreenMsg != null)
        {
            Destroy(firstScreenMsg);
            firstScreenMsg = null;
        }

        UICanvas.SetActive(true);
        cardGroup.SetActive(true);

        arrayPlayerCards = new Card[2];
        arrayPlayerCards[0] = GameObject.Find("PlayerCard1").GetComponent<Card>();
        arrayPlayerCards[1] = GameObject.Find("PlayerCard2").GetComponent<Card>();

        arrayOpponentCards = new Card[2];
        arrayOpponentCards[0] = GameObject.Find("OpponentCard1").GetComponent<Card>();
        arrayOpponentCards[1] = GameObject.Find("OpponentCard2").GetComponent<Card>();

        arrayCommonCards = new Card[5];
        for (int i = 0; i < 5; i++)
        {
            string objName = "CommonCard" + (i + 1);
            arrayCommonCards[i] = GameObject.Find(objName).GetComponent<Card>();
        }

        txtOpponentBet = GameObject.Find("txtOpponentBet").GetComponent<Text>();
        txtPlayerBet = GameObject.Find("txtPlayerBet").GetComponent<Text>();
        inpBetAmount = GameObject.Find("inpBetAmount").GetComponent<InputField>();
    }
Example #9
0
    public void VerifFormule()
    {
        Jardin jardin = terrainHandler.getJardin();
        Communicate comm = new Communicate(SCRIPT_PYTHON, jardin);
        //lance le script
        comm.GetSource().Execute(comm.GetScope());
        for (int i = 1; i <= NB_FORMULE; i++)
        {
            iField = (InputField)GameObject.Find(PATH + "Form_" + i).GetComponent<InputField>();
            output = (Text)GameObject.Find(PATH + "VerifPan_" + i + "/verif_resultat_" + i).GetComponent<Text>();

            if (iField.text == "")
            {
                continue;
            }
            try
            {
                Formule formule = FormuleFactory.parse(iField.text);

                foreach (Element el in jardin.GetElements())
                {
                    Debug.Log(el);
                }

                object pythonForm = comm.HandleForm(formule);
                Func<Jardin, object> unity_my_interp_formul = comm.GetScope().GetVariable<Func<Jardin, object>>("unity_my_interp_formul");
                object pythonJardin = unity_my_interp_formul(jardin);
                Func<object, object, object> unity_eval_one_form = comm.GetScope().GetVariable<Func<object, object, object>>("unity_eval_one_form");
                var res = unity_eval_one_form(pythonJardin, pythonForm);

                //Affiche résultat
                if ((bool)res == true)
                {
                    output.color = Color.green;
                    output.text = "Vrai";
                }
                else
                {
                    output.color = Color.red;
                    output.text = "Faux";
                }
            }
            catch (ParserLogException)
            {
                output.color = Color.red;
                output.text = "Erreur";
                Debug.Log("Erreur formule");
            }
            catch (ValueErrorException)
            {
                output.color = new Color32(255, 128, 0, 255);
                output.text = "Var libre";
            }
            catch (Exception)
            {
                output.color = Color.red;
                output.text = "Erreur imprévue";
            }
        }
    }
Example #10
0
	// Use this for initialization
	void Start () {
        gameOver = GetComponent<Canvas> ();
        gameOver.enabled = false;
        father = GameObject.Find("father");
        Text[] texts = GetComponentsInChildren<Text>();
        foreach (Text i in texts)
        {
            if (i.gameObject.name == "points")
            {
                score = i;
                break;
            }
        }


        Image [] images = GetComponentsInChildren<Image>();
        foreach (Image i in images)
        {
            if (i.gameObject.name == "VisualKeyboard")
            {
                visualKeyboard = i.gameObject;
                visualKeyboard.GetComponent<VisualKeyboardController>().interfaz = this;
                visualKeyboard.SetActive(false);
                break;
            }
        }


        input = GetComponentInChildren<InputField>();
        InputField.OnChangeEvent se = new InputField.OnChangeEvent();
        se.AddListener(EditInput);
        input.onValueChanged = se;
	}
    // Use this for initialization
    void Start()
    {
        ani = GetComponent<Animator>();
        cgroup = GetComponentInChildren<CanvasGroup>();

        //Reset canvas position to screen center
        RectTransform rect = GetComponent<RectTransform>();
        rect.offsetMax = Vector2.zero;
        rect.offsetMin = Vector2.zero;

        infield = GetComponentInChildren<InputField>();
        startTxt = infield.text;

        playername = PlayerPrefs.GetString("PlayerName", "");

        if (playername == "")
        {
            shouldOpen = true;
        }
        else
        {
            shouldOpen = false;
        }
        StartCoroutine(checkDelay());
    }
    void ServerStart()
    {
        //quitMenu.enabled = false;
        //quitMenu = quitMenu.GetComponent<Canvas> ();
        //startMenu = startMenu.GetComponent<Canvas>();
        //serverMenu = serverMenu.GetComponent<Canvas>();
        //startMenu = startMenu.GetComponent<Canvas>();

        //createButton = createButton.GetComponent<Button> ();
        joinButton = joinButton.GetComponent<Button> ();
        backButton = backButton.GetComponent<Button> ();
        createText = createText.GetComponent<Text> ();
        editable = editable.GetComponent<InputField> ();
        //joinButton = joinButton.GetComponent<Button> ();
        //backButton = backButton.GetComponent<Button> ();

        //serverMenu.enabled = false;
        //startMenu.enabled = true;

        //createButton.gameObject.SetActive (true);
        joinButton.gameObject.SetActive (true);
        backButton.gameObject.SetActive (true);
        //createButton.gameObject.SetActive (false);
        //joinButton.gameObject.SetActive (false);
        //backButton.gameObject.SetActive (false);
        //startMenu.enabled = true;
    }
Example #13
0
 void Awake()
 {
     nameText = transform.Find("Info/NameInput").GetComponent<InputField>();
     costText = transform.Find("Info/CostInput").GetComponent<InputField>();
     preconditionsContainer = transform.Find("Vertical/PreconditionsContainer").GetComponent<Transform>();
     postconditionsContainer = transform.Find("Vertical/PostconditionsContainer").GetComponent<Transform>();
 }
	// Use this for initialization
	void Start () {
		 circles = GetComponentsInChildren<Circle>();
		 inputField = GameObject.Find("Canvas/InputField").GetComponent<InputField>();
		 stressBar = GameObject.Find("Canvas/Stress").GetComponent<Slider>();
		 audios = GetComponents<AudioSource>();

		 blackBackground = GameObject.Find("Canvas/BlackBackground");
		 gameOver = GameObject.Find("Canvas/BlackBackground/GameOver");
		 pressEnter = GameObject.Find("Canvas/BlackBackground/PressEnter");
		 gameStart = GameObject.Find("Canvas/BlackBackground/GameStart");
		 healthIndicator = GameObject.Find("Canvas/HealthIndicator").GetComponent<HealthIndicator>();

		 gameOver.SetActive(false);
		 isGameOver = true;
		 healthIndicator.SetTransparency(0f);

		 currentDay = 0;
		 taskIndex = 0;
		 dayTimer = new Timer(30f);
		 endOfDayTimer = new Timer(4f);
		 dayTimer.Reset();
		 taskTimer = new Timer(StepTimeBasedOnDay);
		 prevRandTask = 0;

		 daysData = CSVParser.Parse("Data/days");
	}
Example #15
0
    private void NextInputField( Selectable next, InputField inputField )
    {
        // If it's an input field, also set the text caret
        inputField.OnPointerClick( new PointerEventData( system ) );

        EventSystem.current.SetSelectedGameObject( next.gameObject, new BaseEventData( system ) );
    }
 void Start()
 {
     if (this.GetComponent<InputField>())
     {
         uiInput = this.GetComponent<InputField>();
     }
 }
 // Use this for initialization
 void Start()
 {
     inputText = gameObject.GetComponent<InputField>();
     foreach (Transform child in transform)
         if (child.name == errorObjectName)
             errorObject = child.gameObject;
 }
	// Use this for initialization
	void Start () {
		ipInput = GameObject.Find ("InputField").GetComponent<InputField> ();
		imageNave2 = GameObject.Find ("panelNave2").GetComponent<Image> ();
		imageNave2.enabled = true;
		imageNave = GameObject.Find ("panelNave").GetComponent<Image> ();
		imageNave.enabled = false;
	}
Example #19
0
 void Awake()
 {
     this.appManager = GameObject.FindGameObjectWithTag("Player").GetComponent<ApplicationManager>();
     this.messageControllObj = GameObject.FindGameObjectWithTag("MWindow");
     this.controlls = messageControllObj.GetComponent<MessageController>();
     this.input = this.gameObject.GetComponent<InputField>();
 }
Example #20
0
 // Use this for initialization
 void Start()
 {
     input = gameObject.GetComponent<InputField>();
     se = new InputField.SubmitEvent();
     se.AddListener(SubmitInput);
     input.onEndEdit = se;
 }
Example #21
0
 private void Awake()
 {
     titleControls = GameObject.Find ("Canvas");
     btnStart = titleControls.GetComponentInChildren<Button> ();
     btnStart.onClick.AddListener (() => btnOnclick ());
     inputField = titleControls.GetComponentInChildren<InputField> ();
 }
Example #22
0
    public void AddContents(InputField passField)
    {
        if (system.GetComponent<Main> ().SetMolecule (passField.text,true)) {

            int count = system.GetComponent<Main> ().molecules.Count-1;

            if (count > 4) {
                contents.GetComponent<RectTransform> ().sizeDelta = new Vector2 (contents.GetComponent<RectTransform> ().sizeDelta.x, 20 * (count-1));
            }

            GameObject c = (GameObject)Instantiate (prefab_toggle, new Vector3 (0, prefab_toggle.transform.localPosition.y - 20 * (count-1), 0), Quaternion.identity);

            c.transform.SetParent (contents.transform, false);
            c.GetComponent<Toggle> ().group = contents.GetComponent<ToggleGroup> ();
            c.GetComponent<Toggle> ().isOn = true;
            c.transform.FindChild ("Label").GetComponent<Text> ().text = passField.text;
            labels_mol.Add (c);

            c.GetComponent<Toggle> ().onValueChanged.AddListener (delegate {
                SetCurrentMol (count);
            });

            current_mol = count;
            system.GetComponent<Main> ().SetColors (current_mol);
            system.GetComponent<Main> ().SetMaterials (current_mol);
            system.GetComponent<Main> ().DisplayMolecules (current_mol);
        }
    }
Example #23
0
 public void ApplyMol(InputField passField)
 {
     if (system.GetComponent<Main> ().SetMolecule (passField.text,false,current_mol)) {
         labels_mol[current_mol-1].transform.FindChild ("Label").GetComponent<Text> ().text =passField.text;
         system.GetComponent<Main> ().DisplayMolecules (current_mol);
     }
 }
 void OnEnable()
 {
     inputField = GetComponent<InputField>();
       audioSource = GetComponent<AudioSource>();
       anim = transform.root.GetComponent<Animator>();
       StartCoroutine(SelectInputField());
 }
Example #25
0
    private void Init()
    {
        mTransform = this.transform;
        inputName = mTransform.Find("input_name").GetComponent<InputField>();
        inputName.textComponent = inputName.transform.Find("Text").GetComponent<Text>();
        inputName.text = "请输入名字";

        Button btnHead1 = mTransform.Find("head_1").GetComponent<Button>();
        Button btnHead2 = mTransform.Find("head_2").GetComponent<Button>();
        Button btnEntergame = mTransform.Find("btn_entergame").GetComponent<Button>();
        Button btnRandomname = mTransform.Find("btn_randomName").GetComponent<Button>();

        btnEntergame.onClick.AddListener(OnEnterGame);
        btnRandomname.onClick.AddListener(OnRandomname);

        btn_job1 = mTransform.Find("role_panel/Button_job1").GetComponent<Button>();
        btn_job2 = mTransform.Find("role_panel/Button_job2").GetComponent<Button>();
        btn_job3 = mTransform.Find("role_panel/Button_job3").GetComponent<Button>();

        btn_job1.onClick.AddListener(OnClickJob1);
        btn_job2.onClick.AddListener(OnClickJob2);
        btn_job3.onClick.AddListener(OnClickJob3);

        SetBtnJobState(btn_job1);
    }
    // Use this for initialization
    void Start()
    {
        _highScoreCanvas = GetComponentInChildren<Canvas>();
        PlayerNameInputText = _highScoreCanvas.GetComponentInChildren<InputField>();
        if(PlayerNameInputText != null)
        {
            Text[] inputTexts = PlayerNameInputText.gameObject.GetComponentsInChildren<Text>();
            foreach(Text t in inputTexts)
            {
                if (t.name == "Placeholder") t.text = UsersData.DEFAULT_NAME;
            }
        }

        Text[] texts = _highScoreCanvas.GetComponentsInChildren<Text>();
        foreach(Text t in texts)
        {
            t.fontSize = (int)(t.fontSize * ((Screen.width) / 1236f));

            if (t.name.Contains("Player Name")) RankPlayerNameText = t;
            else if(t.name.Contains("Scores")) RankScoreText = t;
        }

        obj_localHighScore = LocalHighScore.getInstance();
        obj_localHighScore.setMaxUser(maxNumOfUsers);
        minScore = obj_localHighScore.getMinScore();

        LoadScores();
    }
Example #27
0
    void Start()
    {
        showingObject = false;
        selectingTrials = true;
        showingSixObjects = false;
        objectPicked = false;
        maxTimer = 2;
        waitingOneSecond = false;

        inputGO = GameObject.FindGameObjectWithTag("Input");
        input = inputGO.GetComponent<InputField>();

        text1 = GameObject.FindGameObjectWithTag("text1");
        text2 = GameObject.FindGameObjectWithTag("text2");
        text3 = GameObject.FindGameObjectWithTag("text3");
        text4 = GameObject.FindGameObjectWithTag("text4");
        gameover= GameObject.FindGameObjectWithTag("gameover");

        text4.SetActive(false);
        text3.SetActive(false);
        gameover.SetActive(false);

        numObject = 1;
        currentRound = 1;
        rounds = 2;

        score = 0;
    }
 void Reset()
 {
     m_VRMode = GameObject.Find("VRMode").GetComponent<Toggle>();
     m_IPAddress = GameObject.Find("IPAddress/InputField").GetComponent<InputField>();
     m_PortNumber = GameObject.Find("Port/InputField").GetComponent<InputField>();
     m_Message = GameObject.Find("Message").GetComponent<Text>();
 }
 public static int GetInt(InputField inputField)
 {
     int value = 0;
     if (!int.TryParse(inputField.text, out value))
         value = 0;
     return value;
 }
	protected virtual void Awake()
	{
		// Call the base class's function to initialize all variables
		base.Awake();
        Assert.raiseExceptions = true;

        mmsBack = GameObject.Find("MMS_Backdrop");
        if (mmsBack != null)
        {
            mmsBack.SetActive(false);
        }


        //Make sure all UI components exist
		MMS_NumOfBombsSlider = GameObject.Find("MMS_NumOfBombsSlider").GetComponent<Slider>();
        Assert.IsNotNull(MMS_NumOfBombsSlider, "MMS_NumOfBombsSlider not found");
		MMS_NumOfBombsText = GameObject.Find("MMS_NumOfBombsText").GetComponent<Text>();
        Assert.IsNotNull(MMS_NumOfBombsText, "MMS_NumOfBombsText not found");
		MMS_PlanterNameInputField = GameObject.Find("MMS_PlanterNameInputField").GetComponent<InputField>();
        Assert.IsNotNull(MMS_PlanterNameInputField, "MMS_PlanterNameInputField not found");
		MMS_DefuserNameInputField = GameObject.Find("MMS_DefuserNameInputField").GetComponent<InputField>();
        Assert.IsNotNull(MMS_DefuserNameInputField, "MMS_DefuserNameInputField not found");
		MMS_NoNameText = GameObject.Find ("MMS_NoNameText").GetComponent<Text>();
		Assert.IsNotNull(MMS_NoNameText);
		MMS_GameInputField = GameObject.Find ("MMS_GameInputField").GetComponent<InputField>();
		Assert.IsNotNull(MMS_GameInputField);
	}
Example #31
0
    private void RPC_PlayerGetReady(PhotonPlayer photonPlayer)
    {
        textnameg        = GameObject.Find("PlayerName" + photonPlayer.ID.ToString());
        textname         = textnameg.GetComponent <InputField>();
        textname.text    = photonPlayer.NickName;
        textname.enabled = false;
        Debug.Log(photonPlayer.NickName + " Is Ready");
        btnlocalg             = GameObject.Find(photonPlayer.ID.ToString());
        btnlocal              = btnlocalg.GetComponent <Button>();
        btnlocal.interactable = true;
        btnlocal.GetComponent <Image>().sprite        = oui;
        btnlocal.GetComponentInChildren <Text>().text = "Ready";
        btnlocal.GetComponent <Image>().color         = new Color(0.0f, 204.0f / 255.0f, 204.0f / 255.0f, 1.0f);
        allplayerbtn = GameObject.FindGameObjectsWithTag("aa");
        NbPlayerReady++;
        if (NbPlayerReady == PhotonNetwork.room.MaxPlayers)
        {
            magical = new List <string>();
            magical.Add("VVOYANTE");
            magical.Add("VSORCIERE");
            magical.Add("VSALVATEUR");
            Debug.Log(PhotonNetwork.playerList.Length);
            if (true)
            {
                roles = new List <string>();
                roles.Add("L");
                roles.Add("L");
                roles.Add("V");
                roles.Add("V");
            }
            else if (PhotonNetwork.playerList.Length == 8)
            {
                roles = new List <string>();
                roles.Add("L");
                roles.Add("L");
                roles.Add("V");
                roles.Add("L");
                roles.Add(magical[0]);
                roles.Add("V");
                roles.Add("L");
                roles.Add("V");
            }
            else if (PhotonNetwork.playerList.Length == 10)
            {
                roles = new List <string>();
                roles.Add("L");
                roles.Add(magical[1]);
                roles.Add("L");
                roles.Add("V");
                roles.Add("V");
                roles.Add("L");
                roles.Add("L");
                roles.Add("L");
                roles.Add(magical[0]);
                roles.Add("V");
            }
            else
            {
                roles = new List <string>();
                roles.Add(magical[1]);
                roles.Add("L");
                roles.Add("L");
                roles.Add("L");
                roles.Add("V");
                roles.Add("L");
                roles.Add("V");
                roles.Add(magical[0]);
                roles.Add("L");
                roles.Add("L");
                roles.Add(magical[2]);
                roles.Add("V");
            }
        }


        if (PhotonNetwork.isMasterClient)
        {
            if (NbPlayerReady == PhotonNetwork.room.MaxPlayers)
            {
                BtnStart.gameObject.SetActive(true);
            }
        }
    }
Example #32
0
 // Use this for initialization
 void Start()
 {
     mField   = GetComponentInChildren <InputField>();
     Sender   = new CSender();
     listener = CListener.GetInstance();
 }
Example #33
0
 public void OnInputChange(InputField input)
 {
     input.image.color = defaultColor;
 }
 void Start()
 {
     inputField = GetComponent <InputField>();
     inputField.characterLimit = CHARACTER_LIMIT;
 }
Example #35
0
    // Use this for initialization
    void Start()
    {
        GameObject go = Game.CreatePrefab(gameObject, new GameObjectItem
        {
            name   = "伙伴按钮",
            text   = "伙伴",
            width  = 100,
            height = 60,
            prefab = "Prefabs/Button",
            type   = 1,
            x      = 600,
            y      = -350
        });
        var button = go.GetComponent <Button>();

        button.onClick.AddListener(() =>
        {
            HeroHelper.ShowHeroSence(gameObject);
        });

        GameObject bag = Game.CreatePrefab(gameObject, new GameObjectItem
        {
            name   = "背包按钮",
            text   = "背包",
            width  = 100,
            height = 60,
            prefab = "Prefabs/Button",
            type   = 1,
            x      = 500,
            y      = -350
        });

        var bagButton = bag.GetComponent <Button>();

        bagButton.onClick.AddListener(() =>
        {
            Bag.ShowBag();
        });

        GameObject chat = Game.CreatePrefab(gameObject, new GameObjectItem
        {
            name   = "聊天按钮",
            text   = "聊天",
            width  = 100,
            height = 60,
            prefab = "Prefabs/Button",
            type   = 1,
            x      = -600,
            y      = -350
        });

        chat.GetComponent <Button>().onClick.AddListener(() =>
        {
            StartCoroutine(Chat.Init(gameObject, () =>
            {
                InputField text = Game.Find <InputField>("ChatText");

                if (!string.IsNullOrEmpty(text.text))
                {
                    Debug.Log("send");
                    StartCoroutine(User.Post("/Chat/send", new
                    {
                        toId    = "world",
                        content = text.text
                    }, (ChatResponse res) =>
                    {
                        Debug.Log("send1");
                        text.text        = "";
                        Chat.refreshTime = Chat.REFRESH_TIME;
                    })
                                   );
                }
            }));
        });
    }
 void Start()
 {
     matchFoundActionPrompt.SetActive(false);
     inputField = GetComponent <InputField>();
     StartCoroutine(ForceFocusAndCheckAnswer());
 }
Example #37
0
 public void AddName(InputField inputField)
 {
     first_Name = inputField.text;
     UpdateButtonText();
 }
Example #38
0
    public void OnClearText()
    {
        InputField input = GameObject.Find("Search").GetComponent <InputField>();

        input.text = "";
    }
Example #39
0
 private void Awake()
 {
     inputFields = new InputField[] { comPortField, leftServoField, rightServoField, servoPowerField, encoderInterruptField, encoderSecondaryField, iRSensorField, solenoidField };
     Load();
 }
Example #40
0
 private static object ConvertValue(
     InputField field,
     ITypeConversion converter,
     object value)
 {
     if (value is { } &&
Example #41
0
 private void Start()
 {
     input = GetComponentInChildren <InputField>();
 }
Example #42
0
 public SliderInputCombo(Slider Slider, InputField Field)
 {
     this.Slider = Slider;
     this.Field  = Field;
 }
Example #43
0
    // Use this for initialization
    void Start()
    {
        userId    = um.getCurrentUserId();
        userToken = um.getCurrentSessionToken();


        CardColors.Add(Orca);
        CardColors.Add(Favourit);
        CardColors.Add(Love);
        CardColors.Add(Tonight);
        CardColors.Add(Lagoon);
        CardColors.Add(Roseanna);
        setCardColor(new System.Random().Next(0, 5));



        cardHolderError = GameObject.Find("CardHolderPanel").GetComponent <Animator>();
        cardNumberError = GameObject.Find("CardNumberPanel").GetComponent <Animator>();
        DAEError        = GameObject.Find("DAEPanel").GetComponent <Animator>();
        CVVError        = GameObject.Find("CVVPanel").GetComponent <Animator>();
        cardHolder      = GameObject.Find("card holder").GetComponent <InputField>();
        cardNumber      = GameObject.Find("card number").GetComponent <InputField>();
        CVV             = GameObject.Find("CVV").GetComponent <InputField>();
        Years           = GameObject.Find("Years").GetComponent <Dropdown>();
        Month           = GameObject.Find("Months").GetComponent <Dropdown>();
        GameObject.Find("Card/Front/" + paymentCard).GetComponent <Image>().transform.localScale = Vector3.one;
        GameObject.Find("Card/Back/" + paymentCard).GetComponent <Image>().transform.localScale  = Vector3.one;
        //Credit Amount
        Amount = GameObject.Find("Amount").GetComponent <Text>();
        //Toggle
        TermsToggel = GameObject.Find("ToggleTerms").GetComponent <Toggle>();
        //charge
        Credit = GameObject.Find("Credit").GetComponent <Button>();
        Credit.onClick.AddListener(() =>
        {
            confirmCredit();
        });
        try
        {
            Amount.text = WalletScript.LastCredit.ToString("N2").Replace(",", ".") + CurrencyManager.CURRENT_CURRENCY;
            TermsToggel.onValueChanged.AddListener(delegate
            {
                if (TermsToggel.isOn == true)
                {
                    Credit.interactable = true;
                }
                else
                {
                    Credit.interactable = false;
                }
            });
        }
        catch (NullReferenceException)
        {
        }
        cardHolder.onValueChanged.AddListener(delegate
        {
            card_Name.text = cardHolder.text;
            if (cardHolderError.GetBool("wrongcardholder") == true)
            {
                cardHolderError.SetBool("wrongcardholder", false);
            }
        });
        string content = "";

        cardNumber.onValueChanged.AddListener(delegate
        {
            content          = cardNumber.text;
            card_Number.text = separated(content);
            Debug.Log(content);
            card_NumberHint.text = numberhintEditor(content);
            if (cardNumberError.GetBool("wrongcardnumber") == true)
            {
                cardNumberError.SetBool("wrongcardnumber", false);
            }
        });
        CVV.onValueChanged.AddListener(delegate
        {
            card_CVV.text = CVV.text;
            if (CVVError.GetBool("cvverror") == true)
            {
                CVVError.SetBool("cvverror", false);
            }
        });
        Month.onValueChanged.AddListener(delegate
        {
            int _monthIndex    = GameObject.Find("Months").GetComponent <Dropdown>().value;
            string valueMonths = GameObject.Find("Months").GetComponent <Dropdown>().options[_monthIndex].text;
            if (valueMonths != "MM")
            {
                card_ExpireDate_Month.text = valueMonths;
            }
            else
            {
                card_ExpireDate_Month.text = "";
            }
            if (DAEError.GetBool("daeerror") == true)
            {
                DAEError.SetBool("daeerror", false);
            }
        });
        Years.onValueChanged.AddListener(delegate
        {
            int _yearIndex    = GameObject.Find("Years").GetComponent <Dropdown>().value;
            string valueYears = GameObject.Find("Years").GetComponent <Dropdown>().options[_yearIndex].text;
            if (valueYears != "YYYY")
            {
                card_ExpireDate_Year.text = valueYears.Substring(2, 2);
            }
            else
            {
                card_ExpireDate_Year.text = "";
            }
            if (DAEError.GetBool("daeerror") == true)
            {
                DAEError.SetBool("daeerror", false);
            }
        });

        try
        {
            for (int i = DateTime.Today.Year; i < DateTime.Today.Year + 50; i++)
            {
                Years.options.Add(new UnityEngine.UI.Dropdown.OptionData()
                {
                    text = i.ToString()
                });
            }
            for (int i = 1; i <= 12; i++)
            {
                if (i < 10)
                {
                    Month.options.Add(new UnityEngine.UI.Dropdown.OptionData()
                    {
                        text = "0" + i.ToString()
                    });
                }
                else
                {
                    Month.options.Add(new UnityEngine.UI.Dropdown.OptionData()
                    {
                        text = i.ToString()
                    });
                }
            }
        }
        catch (NullReferenceException ex) { }
    }
Example #44
0
 private void Start()
 {
     textNum = transform.Find("BG/InputField").GetComponent <InputField>();
 }
Example #45
0
    public InputField getInputField(string name)
    {
        InputField inputObj = GameObject.Find(name).GetComponent <InputField>();

        return(inputObj);
    }
Example #46
0
 private void Awake()
 {
     input = GetComponentInChildren <InputField>();
 }
 public void setTimeStepsPerSecond(InputField timeStepsField)
 {
     settings.currentSettings.timeStepsPerSecond = int.Parse(timeStepsField.text);
 }
 public void setPolarSteps(InputField polarStepsField)
 {
     settings.currentSettings.polarSteps = int.Parse(polarStepsField.text);
 }
Example #49
0
    public void ProcessTransaction(InputField text)
    {
        var amt = Int32.Parse(text.text);

        Logic.daily_expenditures += amt;
    }
 public void setTotalTime(InputField totalTimeField)
 {
     settings.currentSettings.totalTimeSeconds = int.Parse(totalTimeField.text);
 }
    private void FindGameObjectWithName()
    {
        AddActiveHotspotScript = FindObjectOfType <AddActiveHotspot> ();
        Dome = GameObject.Find("DomeFull").GetComponent <SetupDome>();
        NewHotspotContainer     = GameObject.Find("NavigationCanvas");
        NewActionHotspotTemplet = GameObject.Find("ActionHotspotTemplet");
        //NewActionHotspotTemplet.transform.GetChild(0).gameObject.SetActive (true);

        Hotspot_Name          = GameObject.Find("Btn_ID").transform.GetComponent <Text> ();
        Target_Object         = GameObject.Find("Target_Object").transform.GetChild(0).transform.GetComponent <Dropdown>();
        UserAction_InputField = AddActiveHotspotScript.UserAction_InputField;
        Action_MediaFiles     = AddActiveHotspotScript.Action_MediaFiles;
        Action_UnityObjects   = AddActiveHotspotScript.Action_UnityObjects;
        ActionLable           = AddActiveHotspotScript.Action_Lable;
        ScrolFactorInput      = AddActiveHotspotScript.ScrolFactorInput;
        Action_SceneList      = AddActiveHotspotScript.Action_SceneList;
        LableBox                = AddActiveHotspotScript.LabelBoxPrfb;
        Hotspot                 = AddActiveHotspotScript.Hotspot;
        MediaFilePrfb           = AddActiveHotspotScript.MediaFilePrfb;
        UnityObject             = AddActiveHotspotScript.UnityObjectPrfb;
        ActionList_DropDown     = AddActiveHotspotScript.ActionList_DropDown;
        UserActionList_DropDown = AddActiveHotspotScript.UserActionList_DropDown;
        Always                 = AddActiveHotspotScript.Always;
        VisibleWhen            = AddActiveHotspotScript.VisibleWhen;
        Required               = AddActiveHotspotScript.Required;
        Optional               = AddActiveHotspotScript.Optional;
        XYZDropDown            = AddActiveHotspotScript.XYZDropDown;
        ObjectFunctionDropDown = AddActiveHotspotScript.ObjectFunctionDropDown;
        ScaleSlider            = AddActiveHotspotScript.ScaleSlider;
        RotationSilder         = AddActiveHotspotScript.RotationSilder;

        posx = AddActiveHotspotScript.posx;
        posy = AddActiveHotspotScript.posy;

        textPanel          = AddActiveHotspotScript.textPanel;
        navigationPanel    = AddActiveHotspotScript.navigationPanel;
        actionHotspotPanel = AddActiveHotspotScript.ActionHotspotPanal;

        ActionLable.text = "";
        Action_MediaFiles.ClearOptions();
        Action_SceneList.ClearOptions();
        Action_UnityObjects.ClearOptions();
        UserAction_InputField.text = "";


        //getPosition ();
        //GetSelectedHotspot ();
        Target_Object.value = 0;

        Action_SceneList.gameObject.SetActive(false);
        Action_MediaFiles.gameObject.SetActive(false);
        Action_UnityObjects.gameObject.SetActive(false);
        ActionLable.gameObject.SetActive(false);
        XYZDropDown.gameObject.SetActive(false);
        ObjectFunctionDropDown.gameObject.SetActive(false);
        RotationSilder.gameObject.SetActive(false);
        ScaleSlider.gameObject.SetActive(false);

        // Change
        SetupDome.UserActionName.Add(UserAction_InputField.text);
        SetupDome.ActionFunction.Add(Target_Object.captionText.text);
        SetupDome.ActionObject.Add("");


        Dome.GetComponent <SetupDome> ().Always.Add(Always.isOn);
        Dome.GetComponent <SetupDome> ().VisibleWhen.Add(VisibleWhen.isOn);
        Always.isOn      = false;
        VisibleWhen.isOn = false;
    }
Example #52
0
 /// <summary>
 /// ボタンに設定するための関数
 /// </summary>
 /// <param name="fileName"></param>
 public void Do(InputField fileName)
 {
     Do(fileName.text);
 }
 public static void ApplyColor(InputField input, int ok)
 {
     input.colors = ColorManager.SetColor(input.colors, ok);
 }
 // Start is called before the first frame update
 void Start()
 {
     inputField = GetComponent <InputField>();
     InitInputField();
 }
Example #55
0
 public void AddSurname(InputField inputField)
 {
     surname = inputField.text;
     UpdateButtonText();
 }
Example #56
0
    // Adjusts the input fields in the group according to the new value for this input field
    // The fields array must be in this order: house, factory, hospital, none
    void AdjustFieldsInGroup(InputField input, InputField[] fields, out float out0, out float out1, out float out2)
    {
        // Bound the new value
        float newVal;

        OnPercentEntered(input, out newVal);

        // Find the index of input in fields
        int inputIndex = 0;

        while (inputIndex < fields.Length)
        {
            if (fields[inputIndex] == input)
            {
                break;
            }
            inputIndex++;
        }

        // Get the values of each field
        float[] values = new float[4];
        for (int i = 0; i < 4; i++)
        {
            values[i] = float.Parse(fields[i].text);
        }

        if (inputIndex != 3)
        {
            // Adjust noneVal first, then others
            float totalNoNone    = values[0] + values[1] + values[2];
            float totalTwoOthers = totalNoNone - newVal;

            if (totalNoNone <= 100)
            {
                // Assign the remainder to none
                values[3] = 100 - totalNoNone;
            }
            else
            {
                // Adjust the two fields that are not the edited one
                for (int i = 0; i < 3; i++)
                {
                    if (i != inputIndex)
                    {
                        float share = (values[i] / totalTwoOthers) * (totalNoNone - 100);
                        values[i] -= share;
                    }
                }

                // Set none to 0
                values[3] = 0;
            }
        }
        else
        {
            // Adjust the other three values
            float totalNoNone = values[0] + values[1] + values[2];
            float total       = totalNoNone + values[3];

            for (int i = 0; i < 3; i++)
            {
                float share = (values[i] / totalNoNone) * (total - 100);
                values[i] -= share;
            }
        }

        // Update field text
        for (int i = 0; i < 4; i++)
        {
            fields[i].text = values[i].ToString();
        }

        // Assign out variables
        out0 = values[0];
        out1 = values[1];
        out2 = values[2];
    }
Example #57
0
 public void AddDate(InputField inputField)
 {
     date = inputField.text;
     UpdateButtonText();
 }
Example #58
0
 public void AddSpouse(InputField inputField)
 {
     spouse          = inputField.text;
     spouseText.text = spouse + " ";
 }
Example #59
0
 public void SelectInputField(InputField _input, TMP_InputField _inputTMP)
 {
     this._inputFieldNow    = _input;
     this._inputFieldTMPNow = _inputTMP;
 }
Example #60
0
 public void Reset()
 {
     m_linkField = GetComponent <InputField>();
 }