Beispiel #1
0
    public static void FetchImageCallback(Texture2D texture)
    {
        currentEntity.Texture = texture;
        Sprite tempSpr = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));

        entityImage.sprite = tempSpr;
        entityImage.SetMaterialDirty();
        UIHelperClass.ShowPanel(entityImageObject, true);
    }
Beispiel #2
0
 private void ShowPanel(bool show)
 {
     if (show)
     {
         _mCamera.Play();
     }
     else
     {
         _mCamera.Stop();
     }
     _cameraPanel.SetActive(show);
     UIHelperClass.ShowPanel(_cameraPanel, show);
     enabled = show;
 }
Beispiel #3
0
 public static void SetElements(GameObject locationPanel, GameObject cameraPanel, GameObject nameableInput)
 {
     _locationPanel     = locationPanel;
     _cameraPanel       = cameraPanel;
     _nameableInput     = nameableInput;
     _cameraController  = _cameraPanel.GetComponent <CameraController>();
     _inputField        = _nameableInput.GetComponentInChildren <TMP_InputField>();
     _inputSubmitButton = _nameableInput.GetComponentInChildren <Button>();
     _inputSubmitButton.onClick.AddListener(SubmitEvent);
     _cameraPanel.SetActive(false);
     _nameableInput.SetActive(false);
     UIHelperClass.ShowPanel(_cameraPanel, true);
     UIHelperClass.ShowPanel(_nameableInput, true);
     EventSystem.EventSystem.RegisterListener <NamableEventInfo>(NameableEvent);
 }
Beispiel #4
0
    private void InitialPanelState()
    {
        cameraPanel.SetActive(false);
        startMenu.SetActive(true);
        loadingScreen.SetActive(true);
        loadSavePanel.GetComponent <LeanWindow>().TurnOff();
        LoginPanel.TurnOff();
        RegisterPanel.TurnOff();
        UIHelperClass.ShowPanel(dialoguePanel, false);

        bool tokenExists = PlayerPrefs.GetString("token") != "";

        continueButton.SetActive(tokenExists);
        logoutButton.SetActive(tokenExists);
        loginButton.SetActive(!tokenExists);
    }
Beispiel #5
0
    /*public static DialogueSystem GetDialogueSystem()
     * {
     *  return _dialogueSystem ?? (_dialogueSystem = new DialogueSystem()); //If null, right, if not, left, simple!
     * }*/

    private static void Instantiate()
    {
        _dialoguePanel = GameObject.Find("DialoguePanel").gameObject;
        _textJuicer    = Object.FindObjectOfType <TMP_TextJuicer>().gameObject.GetComponent <TMP_TextJuicer>();
        UIHelperClass.ShowPanel(_dialoguePanel, false);

        for (var i = 0; i < 4; i++)
        {
            _buttonEventHandlers[i] = GameObject.Find("Option" + i).GetComponent <ButtonEventHandler>();
        }

        _dialogueTextMesh = GameObject.Find("DialogueText").GetComponent <TextMeshProUGUI>();

        _defaultContinueEventInfo           = ScriptableObject.CreateInstance <DialogueEventInfo>();
        _defaultContinueEventInfo.eventType = DIALOGUE_EVENT_TYPE.ContinueDialogue;
        _defaultContinueEventInfo.Validate();
    }
Beispiel #6
0
    private static void ShowEntity(EntityEventInfo entityEventInfo)
    {
        LocationSystem.HideNamePanel();
        if (entityEventInfo.entity.Texture == null)
        {
            currentEntity = entityEventInfo.entity;
            APIHandler.getAPIHandler().FetchImage(entityEventInfo.entity.imagePath, FetchImageCallback);
        }
        else
        {
            entityImage.sprite = Sprite.Create(
                entityEventInfo.entity.Texture,
                new Rect(0, 0, entityEventInfo.entity.Texture.width, entityEventInfo.entity.Texture.height),
                new Vector2(0.5f, 0.5f));

            entityImage.SetMaterialDirty();
            UIHelperClass.ShowPanel(entityImageObject, true);
        }
    }
Beispiel #7
0
    private static void Show(LocationEventInfo locationEventInfo)
    {
        locationName.text = locationEventInfo.location.name;
        UIHelperClass.ShowPanel(LocationNamePanel, true);
        if (locationEventInfo.location.Texture == null)
        {
            currentLocationEventInfo = locationEventInfo;
            APIHandler.getAPIHandler().FetchImage(locationEventInfo.location.imagePath, FetchImageCallback);
        }
        else
        {
            locationPanelImage.sprite = Sprite.Create(
                locationEventInfo.location.Texture,
                new Rect(0, 0, locationEventInfo.location.Texture.width, locationEventInfo.location.Texture.height),
                new Vector2(0.5f, 0.5f));

            locationPanelImage.SetMaterialDirty();
        }
    }
Beispiel #8
0
    private static void DialogueEvent(DialogueEventInfo e)
    {
        switch (e.eventType)
        {
        case DIALOGUE_EVENT_TYPE.StartDialogue:
            e.dialogue.current = e.dialogue.first;
            UIHelperClass.ShowPanel(_dialoguePanel, true);
            _textJuicer.enabled = e.juicy;
            SetCurrentDialogue(e.dialogue);
            break;

        case DIALOGUE_EVENT_TYPE.ContinueDialogue:
            ContinueDialogue(e.node);
            break;

        case DIALOGUE_EVENT_TYPE.EndDialogue:
            UIHelperClass.ShowPanel(_dialoguePanel, false);
            _textJuicer.enabled = false;
            break;
        }
    }
Beispiel #9
0
 private static void HideEntity(EntityEventInfo entityEventInfo)
 {
     UIHelperClass.ShowPanel(entityImageObject, false);
 }
Beispiel #10
0
        private void PrepareAndAddCurrencyStats(string ticker, string displayName, ref ScrollViewer scrollViewer)
        {
            TextBlock        currencyLabel, usdLabel, btcLabel, userAmountLabel, userUSDValueLabel;
            CustomStackPanel stackPanelToUpdate;

            string
                stackPanelStr               = ticker + "StackPanel",
                labelStr                    = ticker + "Label",
                labelContentStr             = displayName + " Stats:",
                labelUSDStr                 = ticker + "USD",
                labelUSDContentStr          = "USD Price: $" + result.price_usd,
                labelBTCStr                 = ticker + "BTC",
                labelBTCContentStr          = "BTC Price: " + result.price_btc,
                labelUserAmountStr          = ticker + "UserAmount",
                labelUserAmountContentStr   = "Amount you own: ",
                labelUserUSDValueStr        = ticker + "UserUSDVal",
                labelUserUSDValueContentStr = "Your estimated USD value: ";

            // add label if currency not already displayed
            stackPanelToUpdate = GetChildOfStackPanel(rightStackPanelRef, stackPanelStr) as CustomStackPanel;

            if (stackPanelToUpdate == null)
            {
                // create new StackPanel to hold labels
                stackPanelToUpdate = new CustomStackPanel
                {
                    Name   = stackPanelStr,
                    Margin = new Thickness(5, 0, 5, 5)
                };

                stackPanelToUpdate.PointerEntered += PointerEnteredStackPanel;
                stackPanelToUpdate.PointerExited  += PointerExitedStackPanel;

                ColumnDefinition currencyLabelColumnDefinitionLeft = new ColumnDefinition
                {
                    Width = new GridLength(8, GridUnitType.Star)
                };
                ColumnDefinition currencyLabelColumnDefinitionRight = new ColumnDefinition
                {
                    Width = new GridLength(2, GridUnitType.Star)
                };

                // create and add currency grid
                Grid currencyGrid = new Grid
                {
                    HorizontalAlignment = HorizontalAlignment.Left
                };

                currencyGrid.ColumnDefinitions.Add(currencyLabelColumnDefinitionLeft);
                currencyGrid.ColumnDefinitions.Add(currencyLabelColumnDefinitionRight);

                currencyLabel = new TextBlock
                {
                    FontWeight = FontWeights.Bold,
                    FontSize   = 40,
                    Text       = labelContentStr,
                    Name       = labelStr
                };
                currencyGrid.Children.Add(currencyLabel);
                Grid.SetColumn(currencyLabel, 0);

                //Button deleteCurrencyButton = new Button
                stackPanelToUpdate.RemoveButton = new Button
                {
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Content             = new SymbolIcon(Symbol.Clear),
                    Tag        = stackPanelStr,
                    Background = new SolidColorBrush {
                        Opacity = 0
                    },
                    Opacity   = 0,
                    IsEnabled = false
                };

                stackPanelToUpdate.RemoveButton.Click += RemoveCurrencyStatsForCurrency;

                currencyGrid.Children.Add(stackPanelToUpdate.RemoveButton);
                Grid.SetColumn(stackPanelToUpdate.RemoveButton, 1);

                //stackPanelToUpdate.Children.Add(currencyLabel);
                stackPanelToUpdate.Children.Add(currencyGrid);

                // create and add usdLabel
                usdLabel = new TextBlock
                {
                    Name     = labelUSDStr,
                    FontSize = 22,
                    Text     = labelUSDContentStr
                };
                stackPanelToUpdate.Children.Add(usdLabel);

                // create and add btcLabel
                btcLabel = new TextBlock
                {
                    Name     = labelBTCStr,
                    FontSize = 22,
                    Text     = labelBTCContentStr
                };
                stackPanelToUpdate.Children.Add(btcLabel);

                // create and add user holding amount label
                userAmountLabel = new TextBlock
                {
                    Name     = labelUserAmountStr,
                    FontSize = 22,
                    Text     = labelUserAmountContentStr + addedAmount.ToString()
                };
                stackPanelToUpdate.Children.Add(userAmountLabel);

                // create and add userUSDValue label
                userUSDValueLabel = new TextBlock
                {
                    Name       = labelUserUSDValueStr,
                    FontSize   = 22,
                    Text       = UpdateUserUSDValueContentStr(ref stackPanelToUpdate, this.result.price_usd, labelUserUSDValueContentStr),
                    Foreground = new SolidColorBrush(Colors.ForestGreen)
                };
                stackPanelToUpdate.Children.Add(userUSDValueLabel);

                rightStackPanelRef.Children.Add(stackPanelToUpdate);

                PopInThemeAnimation popInAnimation = new PopInThemeAnimation
                {
                    Duration             = new Duration(TimeSpan.FromSeconds(1)),
                    FromHorizontalOffset = 300,
                    TargetName           = stackPanelToUpdate.Name
                };

                Storyboard.SetTarget(popInAnimation, stackPanelToUpdate);

                Storyboard popInAnimationStoryboard = new Storyboard();
                popInAnimationStoryboard.Children.Add(popInAnimation);
                popInAnimationStoryboard.Begin();
            }
            else
            {
                // update user value
                stackPanelToUpdate.UserValue = addedAmount * Convert.ToDouble(this.result.price_usd);

                // update price labels
                usdLabel               = GetChildOfStackPanel(stackPanelToUpdate, labelUSDStr) as TextBlock;
                usdLabel.Text          = labelUSDContentStr;
                btcLabel               = GetChildOfStackPanel(stackPanelToUpdate, labelBTCStr) as TextBlock;
                btcLabel.Text          = labelBTCContentStr;
                userUSDValueLabel      = GetChildOfStackPanel(stackPanelToUpdate, labelUserUSDValueStr) as TextBlock;
                userUSDValueLabel.Text = UpdateUserUSDValueContentStr(ref stackPanelToUpdate, this.result.price_usd, labelUserUSDValueContentStr);
                userAmountLabel        = GetChildOfStackPanel(stackPanelToUpdate, labelUserAmountStr) as TextBlock;
                userAmountLabel.Text   = labelUserAmountContentStr + addedAmount.ToString();

                PopInThemeAnimation popInAnimation = new PopInThemeAnimation
                {
                    Duration             = new Duration(TimeSpan.FromSeconds(1)),
                    FromHorizontalOffset = 300,
                    TargetName           = userUSDValueLabel.Name
                };

                Storyboard.SetTarget(popInAnimation, userUSDValueLabel);

                Storyboard popInAnimationStoryboard = new Storyboard();
                popInAnimationStoryboard.Children.Add(popInAnimation);
                popInAnimationStoryboard.Begin();
            }

            UIHelperClass.ScrollToElement(scrollViewer, stackPanelToUpdate);
        }
Beispiel #11
0
 public static void HideNamePanel()
 {
     UIHelperClass.ShowPanel(LocationNamePanel, false);
 }