Exemple #1
0
 /// <summary> Creates an Interactable Path from encoding a seed string </summary>
 private void CreatePath()
 {
     if (Path == null || Path.Length == 0)
     {
         SeedConverter converter = new SeedConverter();
         path = converter.encodeSeed(SeedManager.InputSeed);
     }
 }
Exemple #2
0
    private void SetProgressText()
    {
        SeedConverter converter  = new SeedConverter();
        string        SeedString = converter.DecodeSeed();
        int           length     = Mathf.RoundToInt(10.0f / (float)InteractableConfig.ActionsPerGame * (float)InteractableLog.Log.Count);

        progressText.text = SeedString.Substring(0, length);
        progressPartialIcon.GetComponent <RectTransform>().localPosition = new Vector3(length * 22 - 80, 0, 0);
    }
Exemple #3
0
        private void Update()
        {
            if (InteractableManager.InteractableList.Length == 0)
            {
                return;
            }

            if (GameManager.Mode == GameMode.Rehearsal)
            {
                if (!isNextHighlighted)
                {
                    InteractablePath.InitializeNextInteractable();
                    isNextHighlighted = true;
                }

                if (InteractablePath.PathComplete)
                {
                    GameManager.State = GameState.End;
                    EndGameUI.ToggleOn();
                }
                else if (LevelManager.IsMultiLevelGame && ShowLevelComplete)
                {
                    GameManager.State = GameState.Menu;
                    LevelClearUI.ToggleOn();
                }
            }
            else if (GameManager.Mode == GameMode.Recall)
            {
                if (InteractableLog.PathComplete)
                {
                    SeedConverter converter = new SeedConverter();
                    SeedString        = converter.DecodeSeed();
                    GameManager.State = GameState.End;
                    EndGameUI.ToggleOn();
                }
                else if (LevelManager.IsMultiLevelGame && ShowLevelComplete)
                {
                    GameManager.State = GameState.Menu;
                    LevelClearUI.ToggleOn();
                }
            }
        }
Exemple #4
0
    /// <summary> Toggles On the EndGameUI </summary>
    static public void ToggleOn()
    {
        if (Instance.gameObject.activeSelf)
        {
            return;
        }

        Instance.gameObject.SetActive(true);
        var           textList  = Instance.GetComponentsInChildren <TMPro.TextMeshProUGUI>();
        SeedConverter converter = new SeedConverter();

        textList[0].text = converter.DecodeSeed();

        if (GameManager.Mode == GameMode.Rehearsal)
        {
            textList[1].text = "Practice Complete!";
        }
        else
        {
            textList[1].text = "Seed is Recovered!";
        }
    }
Exemple #5
0
    /// <summary> Toggles On the EndGameUI </summary>
    static public void ToggleOn()
    {
        if (Instance.gameObject.activeSelf)
        {
            return;
        }

        Instance.gameObject.SetActive(true);
        var            textList  = Instance.GetComponentsInChildren <TMPro.TextMeshProUGUI>();
        SeedConverter  converter = new SeedConverter();
        BIP39Converter bpc       = new BIP39Converter();

        //textList[0].text = converter.DecodeSeed();

/*        for (int i = 0; i < textList.Length; i++)
 *      {
 *          Debug.Log("Text data #" + i + ": " + textList[i].text);
 *      }
 */
        if (InteractableConfig.SeedHexLength % 2 == 1)
        {
            string alteredSeedText = converter.DecodeSeed();
            string sentence        = bpc.getSentenceFromHex(alteredSeedText);

            char[] array = alteredSeedText.ToCharArray();
            array[array.Length - 2] = array[array.Length - 1];
            alteredSeedText         = new string(array);
            if (alteredSeedText.Length > 1)
            {
                alteredSeedText = alteredSeedText.Substring(0, (alteredSeedText.Length - 1));
            }

            hexSeed          = alteredSeedText;
            bipSeed          = sentence;
            textList[0].text = sentence;
        }
        else
        {
            //textList[0].text = converter.DecodeSeed();
            string hex      = converter.DecodeSeed();
            string sentence = bpc.getSentenceFromHex(hex);
            hexSeed          = hex;
            bipSeed          = sentence;
            textList[0].text = sentence;
        }

        //Debug.Log("Hex: " + hexSeed);
        //Debug.Log("Bip: " + bipSeed);

        if (GameManager.Mode == GameMode.Rehearsal)
        {
            //textList[2].text = "Key Learned!";
            textList[3].text = "Practice Again";
        }
        else
        {
            //textList[2].text = "Key Recovered!";
            textList[3].text = "Try Again";
        }

        for (int i = 0; i < textList.Length; i++)
        {
            //Debug.Log("Text data #" + i + ": " + textList[i].text);
        }

        setupCharacterMode();
    }
Exemple #6
0
        static public InteractableID[] GetPathIDsFromSeed(string seed)
        {
            SeedConverter converter = new SeedConverter();

            return(converter.getPathIDs(seed));
        }
Exemple #7
0
        /// <summary> Generated Path of Interactables from a Seed string </summary>
        static public void GeneratePathFromSeed(string seed)
        {
            SeedConverter converter = new SeedConverter();

            Instance.path = new List <Interactable>(converter.encodeSeed(seed));
        }
    /// <summary> Decodes Log into a Seed string </summary>
    public string RecoverSeed()
    {
        SeedConverter converter = new SeedConverter();

        return(converter.DecodeSeed(this));
    }
Exemple #9
0
 private static Random CreateSeededRandom(string?seedText)
 {
     return(string.IsNullOrWhiteSpace(seedText) ? new Random() : new Random(SeedConverter.CalculateSeedNumberFromString(seedText)));
 }
    private void Update()
    {
        SeedConverter converter = new SeedConverter();

        seed = converter.InteractableListToSeed(list);
    }