コード例 #1
0
    public void SetToChoice(Choice choice)
    {
        //TODO fix this sound
        E_ActorCategory category = choice.ParentEvent.ConversationActor.ActorCategory;

        var data = uiTypes.GetDataForCategory(category);


        EmitterAppear.Play();
        if (data == null)
        {
            Debug.LogError($"No UI data found for {choice.ParentEvent.ConversationActor.ActorCategory}");
            return;
        }

        currentChoice = choice;
        SetVisible(true);
        choiceText.text = choice.Text;

        choiceText.font = data.font;
        //choiceText.UpdateFontAsset();
        choiceText.alignment = TextAlignmentOptions.Left;
        choiceText.font      = data.font;

        var parrentButton = choiceText.GetComponentInParent <Button>();
        var parrentImage  = choiceText.GetComponentInParent <Image>();

        var spriteState = parrentButton.spriteState;

        spriteState.pressedSprite     = data.PressedSprite;
        spriteState.selectedSprite    = data.SelectedSprite;
        spriteState.highlightedSprite = data.SelectedSprite;
        parrentButton.spriteState     = spriteState;
        parrentImage.sprite           = data.DefaultSprite;
    }
コード例 #2
0
        public bool AddItem(List <Item> itemsInBox)
        {
            #region Adding Process

            clonedItemList = itemList;//do a copy itemList

            foreach (Item itemInBox in itemsInBox)
            {
                bool alreadyHave = false;

                foreach (Item itemInPack in clonedItemList)
                {
                    if (itemInBox.body == itemInPack.body)//already have the same item
                    {
                        Debug.Log("have same item");

                        Item t = new Item();//replace the old item
                        t.body = itemInBox.body;
                        t.body.GetComponent <ItemProperty>().name = itemInBox.body.GetComponent <ItemProperty>().name;
                        t.amount = (itemInPack.amount + itemInBox.amount);
                        t.body.GetComponent <ItemProperty>().description   = itemInBox.body.GetComponent <ItemProperty>().description;
                        clonedItemList[clonedItemList.IndexOf(itemInPack)] = t;

                        alreadyHave = true;
                        break;
                    }
                }
                if (alreadyHave)
                {
                    continue;
                }
                clonedItemList.Add(itemInBox);//add new item
            }

            #endregion

            #region Display Message

            if (clonedItemList.Count > capacity)//check if the backpack is not full, then update the backpack
            {
                itemInfo.text = "backpack is full";
                itemInfo.GetComponentInParent <InfoManager>().ShowInfo();
                return(false);
            }

            itemInfo.text = "Get \n";
            foreach (Item itemInBox in itemsInBox)
            {
                itemInfo.text += (itemInBox.body.GetComponent <ItemProperty>().name + " x " + itemInBox.amount.ToString() + "\n");
            }
            itemInfo.GetComponentInParent <InfoManager>().ShowInfo();

            //update backpack
            itemList = clonedItemList;
            DisplayItemData();
            return(true);

            #endregion
        }
コード例 #3
0
 private void Awake()
 {
     if (instance != null)
     {
         DestroyImmediate(instance.gameObject);
         Debug.LogWarning("More than once IGC_VisualManager instance found!");
     }
     instance = this;
     Init();
     canvas = GetComponentInChildren <Canvas>();
     suggestionBackground = SuggestionsField.GetComponentInParent <Image>();
 }
コード例 #4
0
        public void UpdateTexts()
        {
            nameText.text    = string.Format("<b>Lv.{0}</b> {1}", lastLevel, OnlinePlayer.Name);
            summaryText.text = string.Format("<b>Rating</b> {0:0.00}", lastRating);

            var uiElement = UIManager.GetUiElements("ProfileRoot", "MusicSelection");

            if (uiElement.Count > 0 && uiElement[0].isVisible)
            {
                summaryText.text += string.Format("  <b>Exp</b> {0}/{1}", OnlinePlayer.Exp, OnlinePlayer.NextExp);
            }

            LayoutRebuilder.ForceRebuildLayoutImmediate(summaryText.GetComponentInParent <RectTransform>());
        }
コード例 #5
0
 public void DisableWizardUI()
 {
     DisableWizardSkillBar();
     wizardNameText.GetComponentInParent <RectTransform> ().localScale = new Vector3(0, 0, 0);
     Destroy(wizardHpSlider.gameObject);
     Destroy(wizardBackground.gameObject);
 }
コード例 #6
0
        private static LogSelectorResult AddLogSelectorComponent(ChirpQuantumConsole chirpConsole)
        {
            if (chirpConsole == null)
            {
                return(LogSelectorResult.UnableToAdd);
            }

            SerializedObject   so = new SerializedObject(chirpConsole);
            SerializedProperty _consoleLogText      = so.FindProperty("_consoleLogText");
            TextMeshProUGUI    consoleTextContainer = _consoleLogText.objectReferenceValue as TextMeshProUGUI;

            bool createdNew = false;

            var allLogSelectorsFound = chirpConsole.GetComponentsInChildren <QuantumConsoleLogSelector>();
            QuantumConsoleLogSelector targetLogSelector = null;

            if (allLogSelectorsFound.Length > 1)
            {
                for (int i = 0; i < allLogSelectorsFound.Length; i++)
                {
                    if (Application.isPlaying)
                    {
                        Object.Destroy(allLogSelectorsFound[i]);
                    }
                    else
                    {
                        Object.DestroyImmediate(allLogSelectorsFound[i]);
                    }
                }
            }
            else if (allLogSelectorsFound.Length == 1)
            {
                targetLogSelector = allLogSelectorsFound[0];
            }
            else
            {
                // no log selector found, we need to create one
                ScrollRect    consoleTextScrollRect = consoleTextContainer.GetComponentInParent <ScrollRect>();
                RectTransform targetTransform       = consoleTextScrollRect.viewport;

                targetLogSelector = targetTransform.gameObject.AddComponent <QuantumConsoleLogSelector>();
                createdNew        = true;
            }

            if (targetLogSelector == null)
            {
                return(LogSelectorResult.UnableToAdd);
            }

            SerializedObject   targetSo             = new SerializedObject(targetLogSelector);
            SerializedProperty _textComponent       = targetSo.FindProperty("_textComponent");
            SerializedProperty _chirpQuantumConsole = targetSo.FindProperty("_chirpQuantumConsole");

            _textComponent.objectReferenceValue       = consoleTextContainer;
            _chirpQuantumConsole.objectReferenceValue = chirpConsole;

            targetSo.ApplyModifiedPropertiesWithoutUndo();

            return(createdNew ? LogSelectorResult.Success : LogSelectorResult.Updated);
        }
コード例 #7
0
 public void DisableWarriorUI()
 {
     DisableWarriorSkillBar();
     warriorNameText.GetComponentInParent <RectTransform> ().localScale = new Vector3(0, 0, 0);
     Destroy(warriorHpSlider.gameObject);
     Destroy(warriorBackground.gameObject);
 }
コード例 #8
0
        private void SetCharacterProfilesPictures(DialogueFrame currentFrame, bool color = true)
        {
            SetUpDialogueFrame(currentFrame);
            NameText.text = GetCurrentDialogueCharacter(currentFrame).name;
            NameText.GetComponentInParent <Animator>().SetInteger("Position", (int)currentFrame.personTalkingPosition);
            for (int a = 0; a < characters.Count && a < characterProfiles.Count; a++)
            {
                if (characterProfiles[a] != null)
                {
                    if (a == (int)currentFrame.personTalkingPosition)
                    {
                        characterProfiles[a].sprite = currentFrame.personTalking.GetSprite(currentFrame.expression);

                        characterProfiles[a].GetComponent <ColorLerp>().lerpToAlpha(1.0f);
                    }
                    else
                    {
                        if (characters[a] != null)
                        {
                            characterProfiles[a].sprite = currentFrame.personTalking.GetSprite(currentFrame.expression);
                            characterProfiles[a].GetComponent <ColorLerp>().lerpToAlpha(.5f);
                        }
                        else
                        {
                            characterProfiles[a].GetComponent <ColorLerp>().lerpToColor(new Color(0, 0, 0, 0));
                        }
                    }
                }
            }
        }
コード例 #9
0
 public void DisableKnightUI()
 {
     DisableKnightSkillBar();
     knightNameText.GetComponentInParent <RectTransform> ().localScale = new Vector3(0, 0, 0);
     Destroy(knightHpSlider.gameObject);
     Destroy(knightBackground.gameObject);
 }
コード例 #10
0
 private void Awake()
 {
     if (thisCanvas == null)
     {
         thisCanvas      = togOn.GetComponentInParent <Canvas>();
         thisGuiPosition = thisCanvas.transform.position - gameObject.transform.position;
     }
 }
コード例 #11
0
 /// Initialization
 void Awake()
 {
     // TODO: Check for unset values
     if (maximumSize <= 0)
     {
         maximumSize = DEFAULT_MAXIMUM_SIZE;
     }
     mlsr = messageLog.GetComponentInParent <ScrollRect>();
 } // Awake()
コード例 #12
0
    private IEnumerator FadeOutText(TextMeshProUGUI text, float delay)
    {
        yield return(new WaitForSeconds(delay));

        if (text.GetComponentInParent <Button>() != null)
        {
            text.GetComponentInParent <Button>().interactable = false;
        }

        text.color = new Color(text.color.r, text.color.g, text.color.b, 1);

        while (text.color.a > 0.0f)
        {
            text.color = new Color(text.color.r, text.color.g, text.color.b, text.color.a - (Time.deltaTime * 1.0f));
            yield return(null);
        }

        Destroy(text.gameObject);
    }
コード例 #13
0
    public void SetToEvent(Event newEvent)
    {
        if (newEvent.IsClosing)
        {
            return;
        }

        var data = uiTypes.GetDataForCategory(newEvent.EventActor.ActorCategory);

        eventText.text      = newEvent.Text;
        eventText.alignment = data.alignment;
        eventText.font      = data.font;

        var eventBorderRect = eventText.transform.parent.GetComponent <RectTransform>();

        if (data.RightTextPanelOverride != 0)
        {
            var oldScale = eventBorderRect.sizeDelta;
            oldScale.x = data.RightTextPanelOverride;
            eventBorderRect.sizeDelta = oldScale;
        }
        else
        {
            eventBorderRect.sizeDelta = originalScale;
        }

        if (data.UseColorBorder)
        {
            ColorSkinImage.color = newEvent.EventActor.Tint;
            ColorSkinImage.gameObject.SetActive(true);
        }
        else
        {
            ColorSkinImage.gameObject.SetActive(false);
        }


        eventText.GetComponentInParent <Image>().sprite = data.TextBoxSprite;

        var EventActorName = newEvent.EventActor.Name;

        if (EventActorName != "")
        {
            eventTitleText.transform.parent.gameObject.SetActive(true);
            eventTitleText.text = newEvent.EventActor.Name;
            eventTitleText.font = data.font;
            eventTitleText.GetComponentInParent <Image>().sprite = data.TitleSprite;
        }
        else
        {
            eventTitleText.transform.parent.gameObject.SetActive(false);
        }
    }
コード例 #14
0
    private void Start()
    {
        GameManager.ResetCursor();

        infoName                      = GetComponentsInChildren <Canvas>()[3].GetComponentInChildren <TextMeshProUGUI>();
        infoTitle                     = GameObject.FindGameObjectWithTag("InfoTitle").GetComponentInChildren <TextMeshProUGUI>();
        infoText                      = GameObject.FindGameObjectWithTag("InfoText").GetComponentInChildren <TextMeshProUGUI>();
        infoImage                     = GameObject.FindGameObjectWithTag("InfoImage").GetComponent <Image>();
        welcome                       = infoTitle.GetComponentInParent <Canvas>().GetComponentsInChildren <RectTransform>(true)[5];
        buttons                       = infoTitle.GetComponentInParent <Canvas>().gameObject.GetComponentsInChildren <Button>();
        seedInputField                = GetComponentInChildren <TMP_InputField>();
        seedInputField.text           = InteractablePathManager.SeedString;
        seedInputField.characterLimit = InteractableConfig.SeedHexLength;

        GameObject sideNav = GameObject.FindGameObjectWithTag("SideNav");

        for (int i = 0; i < demoList.Length; i++)
        {
            Vector3 position = buttonOffset + new Vector3(0, -i * buttonPadding, 0);
            demoList[i].select = createLevelButton(demoList[i], sideNav.transform, position);
        }

        demoList[0].select.onClick.Invoke();
    }
コード例 #15
0
ファイル: TooltipGO.cs プロジェクト: Rackover/Stackolony
    //Aligne le texte sur la droite ou la gauche (Change ses points de pivots et l'alignement du texte)
    public void SetAlignment(horizontalAlignment alignmentX,verticalAlignment alignmentY = verticalAlignment.TOP)
    {
        RectTransform parentT = myText.GetComponentInParent<RectTransform>();

        switch (alignmentX)
        {
            case horizontalAlignment.RIGHT:
                if (alignmentY == verticalAlignment.TOP)
                {
                   // myText.alignment = (TextAlignmentOptions) TextAnchor.UpperRight;
                    parentT.anchorMin = new Vector2(0.5f, 1);
                    parentT.anchorMax = new Vector2(0.5f, 1);
                    parentT.pivot = new Vector2(0.5f, 1);
                    self.pivot = new Vector2(1, 1);
                } else
                {
                  //  myText.alignment = (TextAlignmentOptions)TextAnchor.LowerRight;
                    parentT.anchorMin = new Vector2(0.5f, 0);
                    parentT.anchorMax = new Vector2(0.5f, 0);
                    parentT.pivot = new Vector2(0.5f, 0);
                    self.pivot = new Vector2(1, 0);
                }
                break;

            case horizontalAlignment.LEFT:
                self.pivot = new Vector2(0, 0);
                if (alignmentY == verticalAlignment.TOP)
                {
                    //myText.alignment = (TextAlignmentOptions)TextAnchor.UpperLeft;
                    parentT.anchorMin = new Vector2(0.5f, 1);
                    parentT.anchorMax = new Vector2(0.5f, 1);
                    parentT.pivot = new Vector2(0.5f, 1);
                    self.pivot = new Vector2(0, 1);
                }
                else
                {
                   // myText.alignment = (TextAlignmentOptions)TextAnchor.LowerLeft;
                    parentT.anchorMin = new Vector2(0.5f, 0);
                    parentT.anchorMax = new Vector2(0.5f, 0);
                    parentT.pivot = new Vector2(0.5f, 0);
                    self.pivot = new Vector2(0, 0);
                }
                break;
        }
    }
コード例 #16
0
ファイル: TreasureManager.cs プロジェクト: secminhr/Fantasy
        public override void Interact()//open the box
        {
            //make sure the box is opened
            isOpen         = true;
            gameObject.tag = "opened";
            gameObject.GetComponentInChildren <SpriteRenderer>().sprite = openSprite;

            //show item info to player
            TextMeshProUGUI itemsInfo = GameObject.Find("ItemsInfo").GetComponent <TextMeshProUGUI>();

            itemsInfo.text = "Get\n";

            //access backpack system
            BackpackManager backpack = GameObject.Find("Backpack").GetComponent <BackpackManager>();

            foreach (Item itemInBox in itemList)
            {
                bool nextItem = false;
                //show what you got
                itemsInfo.text += (itemInBox.body.name + "        x " + itemInBox.amount.ToString() + "\n");

                foreach (Item itemInPack in backpack.itemList)
                {
                    if (itemInBox.body == itemInPack.body)//already have the same item
                    {
                        Debug.Log("have same item");

                        Item t = new Item();//replace the old item
                        t.body   = itemInBox.body;
                        t.amount = (itemInPack.amount + itemInBox.amount);
                        backpack.itemList[backpack.itemList.IndexOf(itemInPack)] = t;

                        nextItem = true;
                        break;
                    }
                }
                if (nextItem)
                {
                    continue;
                }
                backpack.itemList.Add(itemInBox);
            }
            itemsInfo.GetComponentInParent <InfoManager>().ShowInfo();
        }
コード例 #17
0
    /// <summary>
    /// Função que mostra a última pergunta sorteada na tela
    /// </summary>
    public void ShowNewQuestion()
    {
        /// Pega a pergunta que deve ser exibida da lista de perguntas
        selectedQuestion = questionGroup[dificulty].GetQuestion(questionAndAnswer[index].GetQuestionNumber());
        /// Mostra a pergunta
        questionMeshText.text = selectedQuestion.GetQuestion().text;
        questionMeshText.GetComponentInParent <PlayVideoOnMouseOver>().video = selectedQuestion.GetQuestion().video;

        /// Mostra todas as alternativas
        for (int i = 0; i < numberOfAnswers; i++)
        {
            answerMeshText[i].text = selectedQuestion.GetAlternative(i).text;
            answerMeshText[i].GetComponentInParent <PlayVideoOnMouseOver>().video = selectedQuestion.GetAlternative(i).video;
        }

        UnblockButtons();

        StartCoroutine(VideoManager.instance.PlayVideo(selectedQuestion.GetQuestion().video));

        timeManager.StartTimer();
    }
コード例 #18
0
    private void OnTriggerEnter(Collider other)
    {
        //Debug.Log(other.gameObject.name.ToString());

        if (other.gameObject.GetComponent <Piece_Info>())
        {
            if (!other.gameObject.GetComponent <Piece_Info>().hitted)
            {
                PlayFXDmg();
                UpdateBullets(-10);
                bulletsLeft.GetComponentInParent <Canvas>().transform.GetChild(0).GetComponent <Animation>().Play();
            }
            other.transform.parent.gameObject.SetActive(false);
        }
        else if (other.gameObject.tag == "RoomTrigger")
        {
            Destroy(other.gameObject);
            roomCount++;
            int        random   = Random.Range(0, roomsPrefab.Length);
            GameObject instance = Instantiate(roomsPrefab[random]);
            instance.transform.position = new Vector3(0, 0, 100 * roomCount);
        }
    }
コード例 #19
0
    public void ShowDead(string playername)
    {
        switch (playername.ToLower())
        {
        case "player1":
            p1Text.GetComponentInParent <Image>().color = Color.gray;
            break;

        case "player2":
            p2Text.GetComponentInParent <Image>().color = Color.gray;
            break;

        case "player3":
            p3Text.GetComponentInParent <Image>().color = Color.gray;
            break;

        case "player4":
            p4Text.GetComponentInParent <Image>().color = Color.gray;
            break;

        default:
            break;
        }
    }
コード例 #20
0
ファイル: UIController.cs プロジェクト: ben657/ld47
 public void UpdateScore(int newScore)
 {
     scoreText.text = newScore.ToString("D8");
     scoreText.GetComponentInParent <Animator>().SetTrigger("Update");
 }
コード例 #21
0
 private void Awake()
 {
     infoAnimator  = infoText.GetComponentInParent <Animator>();
     timerAnimator = timerText.GetComponent <Animator>();
 }
コード例 #22
0
 public void activateText(float timeLeft)
 {
     scoreBoost.GetComponentInParent <Animator>().SetBool("active", true);
     scoreBoost.SetText("SCORE BOOST ENABLED " + timeLeft);
     active = true;
 }
コード例 #23
0
ファイル: ColorSelector.cs プロジェクト: Fromanov/AR_Zachetka
 void Start()
 {
     hlpLight       = colorTextLight.GetComponentInParent <HorizontalLayoutGroup>();
     hlpDark        = colorTextDark.GetComponentInParent <HorizontalLayoutGroup>();
     umaColorScript = this.GetComponent <UMAChangeColor>();
 }
コード例 #24
0
 public void ClearText()
 {
     textfield.text = "";
     textfield.rectTransform.sizeDelta = new Vector2(textfield.rectTransform.sizeDelta.x, textfield.GetComponentInParent <RectTransform>().sizeDelta.y);
     //textfield.fontSize = default from options
 }
コード例 #25
0
 public void DisableEnemy2UI()
 {
     enemy2NameText.GetComponentInParent <RectTransform> ().localScale = new Vector3(0, 0, 0);
     Destroy(enemy2HpSlider.gameObject);
     Destroy(enemy2Background.gameObject);
 }