Exemplo n.º 1
0
    public void Render(GameEvent gameEvent)
    {
        resultUI_.SetActive(false);
        foreach (Transform child in choices_.transform)
        {
            GameObject.Destroy(child.gameObject);
        }

        gameEvent_  = gameEvent;
        title_.text = gameEvent.Name;
        desc_.text  = gameEvent.Desc;
        desc_.text  = desc_.text.Replace("\\n", "\n");
        if (gameEvent.ImageName != null)
        {
            Sprite eventImage = Resources.Load <Sprite>("Sprites/Events/" + gameEvent.ImageName);
            image_.sprite = eventImage;
        }

        foreach (Choice c in gameEvent_.Choices)
        {
            if (c.CanShowChoice())
            {
                ChoiceUI choiceUI = GameObject.Instantiate(Resources.Load <ChoiceUI> ("Prefabs/ChoiceUI"), choices_.transform);
                choiceUI.Render(c);
            }
        }
        //title_ = gameEvent
    }
Exemplo n.º 2
0
 override public void ActivateSwitch(bool b)
 {
     if (b)
     {
         if (useNamedChildren)
         {
             List <Choice> childChoices = new List <Choice>();
             foreach (Transform t in transform)
             {
                 if (t.gameObject.activeSelf)
                 {
                     childChoices.Add(new Choice(
                                          t.name,
                                          t.GetComponent <Activatable>()
                                          ));
                 }
             }
             ChoiceUI.OpenChoices(childChoices);
         }
         else
         {
             ChoiceUI.OpenChoices(this.choices);
         }
     }
 }
Exemplo n.º 3
0
        public override void Init()
        {
            Sound.Music("customizing", 0.38f).Play();
            var classChoice = CreateWeaponChoice(
                new WeaponSet("Sniper", new RsxCarbine(), new SideArm()),
                new WeaponSet("Bulleteer", new WarUzi(), new AutoPistol()),
                new WeaponSet("Up Close", new WarShotgun(), new PowerMagnum()));

            _activeChoice = classChoice;
            ClickUi.Add(classChoice.Branch);
            Add(new Label
            {
                Text      = "Weldon Zemke",
                Font      = GuiFonts.Header,
                TextColor = UiColors.InGame_Text,
                Transform = new Transform2(new Vector2(0.02.VW(), 0.2.VH()), new Size2(0.20.VW(), 80))
            });
            Add(new Label
            {
                Text      = "Leader of ZFS",
                Font      = GuiFonts.Large,
                TextColor = UiColors.InGame_Text,
                Transform = new Transform2(new Vector2(0.02.VW(), 0.25.VH()), new Size2(0.20.VW(), 80))
            });
            Add(new UiImage
            {
                Image     = "Characters/MainCharacter/MainCharacter-bust.png",
                Transform = new Transform2(new Vector2(-0.06.VW(), 0.3.VH()), new Size2(0.7.VH(), 0.7.VH()))
            });
            Add(_activeChoice);
            Add(new ScreenFade {
                Duration = TimeSpan.FromSeconds(1)
            }.Started());
            Add(_fadeOut);
        }
Exemplo n.º 4
0
 void Start()
 {
     if (choiceUI == null)
     {
         choiceUI = this;
     }
     CloseChoices();
 }
Exemplo n.º 5
0
    private void Start()
    {
        choiceUI        = ChoiceUI.Instance;
        uiController    = UIController.Instance;
        questController = QuestController.Instance;

        cancelQuestButton.onClick.AddListener(() => { TogglePanel(false); });
    }
Exemplo n.º 6
0
        public void PresentPRStatement()
        {
            Debug.Log(statement);
            if (statement == null)
            {
                statement = new PRStatement();

                Sentence sentence = statement.getSentence();

                string prefabPath       = "WordGame/Word";
                string teleprompterPath = "WordGame/Teleprompter";
                string dropdownPath     = "WordGame/Choice";

                GameObject teleprompter = Instantiate(Resources.Load <GameObject>(teleprompterPath), menuCanvas.gameObject.transform);
                Transform  wordParent   = teleprompter.transform.Find("Panel/Viewport/Content/WordPanel");

                // do unity loading stuff for UI here

                List <Word> words = sentence.getWords();
                for (int i = 0; i < words.Count; i++)
                {
                    Word word = words.ElementAt(i);

                    // Display vanilla word
                    if (!word.isOption())
                    {
                        GameObject newVanillaWordObject = Instantiate(Resources.Load <GameObject>(prefabPath), wordParent.transform);
                        WordUI     ui = newVanillaWordObject.GetComponent <WordUI>();

                        ui.setText(word.getVanillaWord());

                        continue;
                    }

                    // Add choice dropdown
                    GameObject newChoiceObject = Instantiate(Resources.Load <GameObject>(dropdownPath), wordParent.transform);
                    ChoiceUI   choiceObject    = newChoiceObject.GetComponent <ChoiceUI>();

                    if (word.isOption())
                    {
                        choiceObject.SetOptions(word.getChoice().options.Keys.ToList(), i);
                    }

                    choiceObject.enabled = true;
                }

                Transform ok       = teleprompter.transform.Find("ButtonPanel").Find("OK");
                Button    okButton = ok.gameObject.GetComponent <Button>();

                okButton.onClick.AddListener(delegate {
                    okButton.onClick.RemoveAllListeners();
                    this.SubmitPrStatements();
                    this.RunRound();
                    Destroy(teleprompter);
                });
            }
        }
Exemplo n.º 7
0
    private void Awake()
    {
        if (instance != null)
        {
            Destroy(this);
            return;
        }

        instance = this;
    }
Exemplo n.º 8
0
    public void OnSubmit()
    {
        if (!DialogueUI.LineFullyRendered())
        {
            return;
        }

        // in the case of a generic "exit" button
        if (activatable != null)
        {
            activatable.Activate();
        }
        ChoiceUI.CloseChoices();
        // if clicked this frame, mimic a dialogue skip input
        if (!InputManager.GenericContinueInput())
        {
            GlobalController.OnDialogueSkip();
        }
    }
Exemplo n.º 9
0
 // Start is called before the first frame update
 void Start()
 {
     randomChoices = choicesData.GetRandomChoices(choiceNumber);
     correctAnswer = Random.Range(0, choiceNumber);
     for (int i = 0; i < randomChoices.Count; i++)
     {
         ChoiceUI choice = Instantiate(ChoicePrefab, Layout);
         choice.button.image.sprite = randomChoices[i].sprite;
         if (correctAnswer == i)
         {
             choice.button.onClick.AddListener(RightAnswer);
             targetClip = randomChoices[i].clip;
         }
         else
         {
             choice.button.onClick.AddListener(WrongAnswer);
         }
     }
     SoundManager.Instance.Play(targetClip);
 }
Exemplo n.º 10
0
 void Awake()
 {
     cUIL = goLeft.GetComponent <ChoiceUI>();
     cUIR = goRight.GetComponent <ChoiceUI>();
 }