Esempio n. 1
0
 void Update()
 {
     if (textInfo != null)
     {
         if (touchingGround)
         {
             textInfo.GetComponent <Text>().text = "on the ground\n";
         }
         else
         {
             textInfo.GetComponent <Text>().text = "in the air\n";
         }
         if (test == 4 && randomVel)
         {
             textInfo.GetComponent <Text>().text += "Max Speed: " + speedRand;
         }
         else
         {
             textInfo.GetComponent <Text>().text += "Max Speed: " + speed;
         }
         textInfo.GetComponent <Text>().text += "\nVelocity:   " + rBody.velocity.magnitude;
     }
     //
     //Debug.Log("Vel: "+rBody.velocity.magnitude);
 }
Esempio n. 2
0
    public void OnEnable()
    {
        CanvasRenderer _render = (CanvasRenderer)target;

        component = _render.GetComponent <Text>();
        if (component != null)
        {
            type     = E_CanvasRendererType.Text;
            foldName = "Odls TextRenderer";
            fold     = EditorPrefs.GetBool(foldName, false);
            return;
        }

        component = _render.GetComponent <Image>();
        if (component != null)
        {
            type     = E_CanvasRendererType.Image;
            foldName = "Odls ImageRenderer";
            fold     = EditorPrefs.GetBool(foldName, false);
            return;
        }

        component = _render.GetComponent <RawImage>();
        if (component != null)
        {
            type     = E_CanvasRendererType.RawImage;
            foldName = "Odls RawImageRenderer";
            fold     = EditorPrefs.GetBool(foldName, false);
            return;
        }
    }
Esempio n. 3
0
 // Display a message explaining that the selection shape drawn is not closed enough
 public void proposeIncompleteShapeSelection()
 {
     undo();
     if (incompleteShapeErrorContainer != null)
     {
         incompleteShapeErrorContainer.GetComponent <Hideable>().Show();
     }
 }
Esempio n. 4
0
 void OnVideoStart()
 {
     //remoteUserPanel.SetActive(false);
     //if (Application.platform != RuntimePlatform.Android)
     //{
     calleeCanvas.GetComponent <RectTransform>().Rotate(new Vector3(0, 0, 90));
     calleeCanvas.GetComponent <RectTransform>().localScale = new Vector3(1f, 1f, 1);
     //}
 }
Esempio n. 5
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            GUILayout.BeginHorizontal();
            if (canvasRenderer.GetComponent <Text>() != null &&
                GUILayout.Button("Replace with TextMeshPro"))
            {
                TextReplacer.ReplaceUnityText(canvasRenderer.GetComponent <Text>());
                GUIUtility.ExitGUI();
            }
            GUILayout.EndHorizontal();
        }
Esempio n. 6
0
    private void Awake()
    {
        gameOverPanel.GetComponent <CanvasRenderer>().SetAlpha(0.0f);
        foreach (Text text in gameOverPanel.GetComponentsInChildren <Text>())
        {
            text.CrossFadeAlpha(0.0f, 0.0f, false);
        }
        tryAgainButton.enabled = false;
        tryAgainButton.GetComponent <CanvasRenderer>().SetAlpha(0.0f);
        tryAgainButton.GetComponentInChildren <Text>().GetComponent <CanvasRenderer>().SetAlpha(0.0f);
        tryAgainButton.onClick.AddListener(TryAgain);

        source = GetComponent <AudioSource>();
    }
    private void MoveDialogueBox()
    {
        Vector2 speakerPosition = currentTrigger.transform.position;
        var     playerPosition  = (Vector2)player.transform.position;
        var     howFarX         = speakerPosition.x - playerPosition.x;

        if (!currentTrigger.Paragraphs[currentParagraphIndex].isPlayer)
        {
            speakerPosition.y += currentTrigger.YDelta;
        }
        else
        {
            speakerPosition    = player.transform.position;
            speakerPosition.y += player.gameObject.GetComponent <SpriteRenderer>().bounds.size.y;
            howFarX            = -howFarX;
        }

        var cameraPosition = Camera.main.transform.position.x;
        var dialogueImage  = dialogueBox.GetComponent <Image>();

        dialogueImage.sprite = howFarX > 0 ? BubbleSprites[1] : BubbleSprites[0];
        speakerPosition.x   += Mathf.Sign(-howFarX) *
                               (canvasTransform.rect.xMax * canvasTransform.localScale[0]) * 0.5f;

        speakerPosition.x = Mathf.Clamp(
            speakerPosition.x,
            cameraPosition - cameraBounds.x + (canvasTransform.rect.width * canvasTransform.localScale[0] * 0.5f),
            cameraPosition + cameraBounds.x - (canvasTransform.rect.width * canvasTransform.localScale[0] * 0.5f)
            );
        canvas.transform.position = speakerPosition;
    }
        IEnumerator GenerateNeuralNetMenuButtons()
        {
            int neuralNetMenuButtonHeight = 30;

            yield return(StartCoroutine
                         (
                             GenerateButtonsFromList
                             (
                                 gestureSettings.neuralNets,
                                 selectNeuralNetMenu.transform.Find("Buttons Parent"),
                                 neuralNetButtonPrefab,
                                 neuralNetMenuButtonHeight,
                                 buttonListAnimationDelay,
                                 value => neuralNetButtons = value
                             )
                         ));

            // set the functions that the button will call when pressed
            for (int i = 0; i < neuralNetButtons.Count; i++)
            {
                neuralNetButtons[i].onClick.AddListener(() => panelManager.FocusPanel("Main Menu"));
                AddSelectNeuralNetListener(i);
            }

            // add on click functions to new neural net button
            Button newNeuralNetButtonButton = newNeuralNetButton.GetComponent <Button>();

            newNeuralNetButtonButton.onClick.RemoveAllListeners();
            newNeuralNetButtonButton.onClick.AddListener(gestureSettings.CreateNewNeuralNet);
            newNeuralNetButtonButton.onClick.AddListener(RefreshNeuralNetMenu);
            newNeuralNetButton.transform.SetAsLastSibling();

            yield break;
        }
Esempio n. 9
0
 //My Method from here
 void FadingIn()
 {
     colorKey -= 0.07f;
     can.GetComponent <CanvasRenderer> ().SetAlpha(colorKey);
     if (colorKey <= 0)
     {
         Destroy(gameObject);
     }
 }
Esempio n. 10
0
    // Use this for initialization
    void Start()
    {
        if (!HealthText)
        {
            return;
        }

        health      = HealthText.GetComponent <Text> ();
        health.text = "NINJA";
    }
Esempio n. 11
0
    // Use this for initialization
    void Start()
    {
        ShowStarBar(false);
        targetStarBarValue = 0;

        //Get star RectTransforms:
        star1RectTransform = star1.GetComponent <RectTransform>();
        star2RectTransform = star2.GetComponent <RectTransform>();
        star3RectTransform = star3.GetComponent <RectTransform>();

        star1Number = star1.GetComponent <DisplayNumbers>();
        star2Number = star2.GetComponent <DisplayNumbers>();
        star3Number = star3.GetComponent <DisplayNumbers>();

        //Get the normale rect width of the stars:
        starNormaleSize     = star1RectTransform.rect.width;
        starMaxSize         = starNormaleSize * 1.25f;
        starNormaleRotation = star1RectTransform.rotation.z;
    }
Esempio n. 12
0
    public void Category(Transform categoryTransform)
    {
        if (!isWork)
        {
            _categoryMain.enabled = !_categoryMain.enabled;
            _categoryRoll.GetComponent <Image>().enabled = !_categoryRoll.GetComponent <Image>().enabled;

            if (_categoryMain.enabled)
            {
                _defaultRoll = _categoryRoll.transform.position;
                _categoryRoll.transform.position = new Vector3(_categoryRoll.transform.position.x, categoryTransform.position.y);
            }
            else
            {
                _categoryRoll.transform.position = _defaultRoll;
                Category(categoryTransform);
            }
        }
    }
Esempio n. 13
0
        // Update is called once per frame
        protected override void Update()
        {
            base.Update();
            if (LoadingOperation == null)
            {
                return;
            }
            double progress = Math.Round(LoadingOperation.progress * 100);

            Text.GetComponent <Text>().text = "Loading... (" + progress + "%)";
        }
Esempio n. 14
0
 // 更改整个乐符对象的颜色
 public void SetColor(Color color)
 {
     // 遍历整个乐符对象,修改CanvasRenderer的颜色属性
     foreach (Transform childTransform in ParentObject.transform)
     {
         // 当乐符对象是划线的时候,使用的是image,修改颜色先找到image组件,然后设置颜色
         CanvasRenderer canvasRenderer = childTransform.gameObject.GetComponent <CanvasRenderer>();
         Image          image          = canvasRenderer.GetComponent <Image>();
         if (image != null)
         {
             image.color = color;
             continue; // 已经确定是划线,后面的不需要执行,直接判断下一个乐符对象
         }
         // 当乐符对象是音符的时候,使用的是text,修改颜色先找到text组件,然后设置颜色
         Text text = canvasRenderer.GetComponent <Text>();
         if (text != null)
         {
             text.color = color;
             continue;
         }
     }
 }
    // Use this for initialization
    void Start()
    {
        start       = new StartPanel(StartPanel);
        credit      = new CreditPanel(CreditPanel);
        instruction = new InstructionPanel(InstructionPanel);

        start.animator       = StartPanel.GetComponent <Animator>();
        credit.animator      = CreditPanel.GetComponent <Animator>();
        instruction.animator = InstructionPanel.GetComponent <Animator>();

        start.Start();
        credit.Start();
        instruction.Start();
    }
Esempio n. 16
0
        private void Update()
        {
            //handle click with head
            if (m_GazeOver)
            {
                gazeBackground.SetAlpha(1f);
                countTime += Time.deltaTime;                                                                 // count down
                gazeSelection.GetComponent <UnityEngine.UI.Image> ().fillAmount = countTime / selectionTime; //fill up circle reticle
                if (countTime >= selectionTime)                                                              // time elapsed
                {
                    countTime = 0f;                                                                          // reset timer
                    mainScript.buttonClicked((string)this.name);                                             // handle click
                    HandleOut();
                }
            }

            if (!m_UIFader)
            {
                return;
            }

            // If this bar is using a UIFader turn off the collider when it's invisible.
            m_Collider.enabled = m_UIFader.Visible;
        }
Esempio n. 17
0
    void Start()
    {
        ButtonComponent = transform.Find("Mask/Mask/BG").GetComponent <Button>();
        ScrollView      = this.transform.Find("Mask/ScrollView").GetComponent <RectTransform>();
        ButtonComponent.onClick.AddListener(ShowScrollView);
        LocalViewCanvas = transform.Find("Mask/Mask/BG").GetComponent <CanvasRenderer>();
        transform.Find("Mask/Mask/BG").GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/Photos/Profile/" + UserDataController.GetInstance().UserImage);

        VideoChat.localView = true;
        if (Application.platform == RuntimePlatform.Android)
        {
            LocalViewCanvas.GetComponent <RectTransform>().Rotate(new Vector3(0, 0, 90));
        }

        PhotoController.GetInstance().OnActiveSetChanged += ForceOpenScrollView;
    }
Esempio n. 18
0
    void aDamage()
    {
        _hp -= 1;
        if (_hp <= 0)
        {
            _hp = 0;
            if (Input.GetKeyDown("1"))
            {
                Application.LoadLevel("Startscene");
            }
        }


        if (_hp == 0)
        {
            gameover.GetComponent <Text> ().enabled = true;
        }
    }
Esempio n. 19
0
        IEnumerator fadeOut(CanvasRenderer cr)
        {
            float f_startTime = Time.time;
            float f_timeRatio = 0f;

            while (f_timeRatio < 1)
            {
                f_timeRatio = (Time.time - f_startTime) / HealthChangeFadeTime;
                if (f_timeRatio >= 1)
                {
                    f_timeRatio = 1;
                }

                //Debug.Log(f_timeRatio);
                cr.GetComponent <CanvasRenderer>().SetAlpha(1 - f_timeRatio);
                if (f_timeRatio == 1)
                {
                    break;
                }

                yield return(null);
            }
        }
Esempio n. 20
0
    private void Awake()
    {
        menuLeftPos  = GameObject.Find("MenuPointerLeft").transform;
        menuRightPos = GameObject.Find("MenuPointerRight").transform;

        _inputManager = GameObject.Find("InputManager").GetComponent <InputManager>();

        _categoryMain = GameObject.Find("CategoryMain").GetComponent <Image>();
        _categoryRoll = GameObject.Find("CategoryRoll").GetComponent <CanvasRenderer>();

        _righttag      = GameObject.FindGameObjectsWithTag("Right");
        _longtag       = GameObject.FindGameObjectsWithTag("Long");
        _everythingtag = GameObject.FindGameObjectsWithTag("Everything");
        _category      = GameObject.FindGameObjectsWithTag("Category");
        _captions      = GameObject.FindGameObjectsWithTag("Caption");
        _fullcaptions  = GameObject.FindGameObjectsWithTag("Full Caption");
        _slicecaptions = GameObject.FindGameObjectsWithTag("Slice Caption");
        _wz            = cube.GetComponent <WheelZoom>();

        _acetCh = GameObject.Find("acetChosen").GetComponent <Image>();
        _dofaCh = GameObject.Find("dofaChosen").GetComponent <Image>();
        _noraCh = GameObject.Find("noraChosen").GetComponent <Image>();
        _seroCh = GameObject.Find("seroChosen").GetComponent <Image>();

        foreach (GameObject category in _category)
        {
            category.SetActive(false);
        }
        foreach (GameObject caption in _slicecaptions)
        {
            caption.SetActive(false);
        }

        _categoryRollImage = _categoryRoll.GetComponent <Image>();

        sliceCategory.SetActive(false);
    }
Esempio n. 21
0
        private void LoadButtons()
        {
            try
            {
                GameObject UserInterface    = GameObject.Find("/UserInterface/MenuContent");
                GameObject VoiceDot         = GameObject.Find("/UserInterface/UnscaledUI/HudContent/Hud/VoiceDotParent/VoiceDot");
                GameObject VoiceDotDisabled = GameObject.Find("/UserInterface/UnscaledUI/HudContent/Hud/VoiceDotParent/VoiceDotDisabled");

                foreach (CanvasRenderer btn in UserInterface.GetComponentsInChildren <CanvasRenderer>(true))
                {
                    try
                    {
                        if (btn.GetComponent <Image>())
                        {
                            quickmenuStuff.Add(btn.GetComponent <Image>());
                        }
                    }
                    catch { }
                }

                foreach (CanvasRenderer btn in QuickMenu.prop_QuickMenu_0.GetComponentsInChildren <CanvasRenderer>(true))
                {
                    try
                    {
                        if (btn.GetComponent <Image>())
                        {
                            quickmenuStuff.Add(btn.GetComponent <Image>());
                        }
                    }
                    catch { }
                }

                foreach (Button btn in QuickMenu.prop_QuickMenu_0.GetComponentsInChildren <Button>(true))
                {
                    try
                    {
                        quickmenuBtn.Add(btn);
                        if (btn.GetComponentInChildren <CanvasRenderer>())
                        {
                            foreach (Image img in btn.GetComponentsInChildren <Image>(true))
                            {
                                quickmenuStuff.Add(img);
                            }
                        }
                    }
                    catch { }
                }


                foreach (Button btn in UserInterface.GetComponentsInChildren <Button>(true))
                {
                    try
                    {
                        quickmenuBtn.Add(btn);
                        if (btn.GetComponentInChildren <CanvasRenderer>())
                        {
                            foreach (Image img in btn.GetComponentsInChildren <Image>(true))
                            {
                                quickmenuStuff.Add(img);
                            }
                        }
                    }
                    catch { }
                }

                foreach (CanvasRenderer btn in VoiceDot.GetComponentsInChildren <CanvasRenderer>(true))
                {
                    try
                    {
                        if (btn.GetComponent <Image>())
                        {
                            quickmenuStuff.Add(btn.GetComponent <Image>());
                        }
                    }
                    catch { }
                }
                foreach (CanvasRenderer btn in VoiceDotDisabled.GetComponentsInChildren <CanvasRenderer>(true))
                {
                    try
                    {
                        if (btn.GetComponent <Image>())
                        {
                            quickmenuStuff.Add(btn.GetComponent <Image>());
                        }
                    }
                    catch { }
                }
                foreach (var CanvasRenderer in Resources.FindObjectsOfTypeAll <CanvasRenderer>())
                {
                    if (CanvasRenderer.GetComponent <Image>())
                    {
                        quickmenuStuff.Add(CanvasRenderer.GetComponent <Image>());
                    }
                }
            }
            catch { }
        }
Esempio n. 22
0
 void Awake()
 {
     //Get star RectTransforms:
     star1RectTransform = star1.GetComponent <RectTransform>();
     star1Number        = star1.GetComponent <DisplayNumbers>();
 }