Beispiel #1
0
        /// <summary>
        /// Saves intro text data to a file with specified file path.
        /// </summary>
        /// <param name="intro">Intro text data to save</param>
        /// <param name="filePath">Path of the file</param>
        private void SaveGoalsDataToFile(IntroText intro, string filePath)
        {
            string dataAsJson = JsonUtility.ToJson(intro, true);

            File.WriteAllText(filePath, dataAsJson);
            //Debug.Log("Saved intro text data to a file...");
        }
        public override void LoadContent()
        {
            Texture2D logoTexture = game.Content.Load <Texture2D>("logo");

            logo = new IntroText(logoTexture);
            logo.Drawable.Origin = new Vector2(logo.Drawable.Texture.Width / 2, logo.Drawable.Texture.Height / 2);
            gameObjects.Add(logo);
        }
Beispiel #3
0
 void Start()
 {
     playerscript     = GameObject.FindGameObjectWithTag("Player").GetComponent <MCMovement>();
     textbox          = (IntroText)Object.FindObjectOfType(typeof(IntroText));
     controltower     = (ControlTowerScript)Object.FindObjectOfType(typeof(ControlTowerScript));
     hangerdoorscript = (HangarDoor)Object.FindObjectOfType(typeof(HangarDoor));
     inventparent     = (InventParent)Object.FindObjectOfType(typeof(InventParent));
     finishlevel      = (FinishLevel)Object.FindObjectOfType(typeof(FinishLevel));
 }
Beispiel #4
0
        /// <summary>
        /// Calculates duration time of display of the introduction text.
        /// </summary>
        /// <param name="introText">Introduction text data</param>
        /// <returns>Introduction text duration</returns>
        private float CalculateTextDuration(IntroText introText)
        {
            float duration = 0f;

            foreach (IntroLine line in introText.Content)
            {
                duration += line.Cooldown + line.Duration;
            }
            return(duration);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (typeCase_ == TypeOneofCase.Swish)
            {
                hash ^= Swish.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Combat)
            {
                hash ^= Combat.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Portkey)
            {
                hash ^= Portkey.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Picture)
            {
                hash ^= Picture.GetHashCode();
            }
            if (DisappearDelay != 0F)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(DisappearDelay);
            }
            if (IntroText.Length != 0)
            {
                hash ^= IntroText.GetHashCode();
            }
            hash ^= stageSetupSequence_.GetHashCode();
            hash ^= stageCompletionSequence_.GetHashCode();
            if (SpellAimLayout.Length != 0)
            {
                hash ^= SpellAimLayout.GetHashCode();
            }
            hash ^= idleLoopTimelines_.GetHashCode();
            if (RngIntroTimeline.Length != 0)
            {
                hash ^= RngIntroTimeline.GetHashCode();
            }
            if (RngLoopTimeline.Length != 0)
            {
                hash ^= RngLoopTimeline.GetHashCode();
            }
            if (SpellFailedTimeline.Length != 0)
            {
                hash ^= SpellFailedTimeline.GetHashCode();
            }
            hash ^= combatSpellList_.GetHashCode();
            hash ^= (int)typeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #6
0
        // Use this for initialization
        void Start()
        {
            // set up in-game menu:
            resumeButton.onClick.AddListener(() => {
                menuOn = false;
                menuPanel.SetActive(menuOn);
            });
            backToMainMenuButton.onClick.AddListener(() => {
                StopAllCoroutines();
                GameManager.instance.BackToMainMenu();
            });
            skipIntroButton.onClick.AddListener(() => {
                GameManager.instance.LoadNextLevel();
            });
            skipIntroButton.gameObject.SetActive(GameManager.instance.DebugMode);
            menuOn = false;
            menuPanel.SetActive(menuOn);
            // start calibration data:
            if (GameManager.instance.BBModule.IsEnabled)
            {
                GameManager.instance.BBModule.CalibrateBandData();
            }
            calibrationLabel.SetActive(true);
            // load intro text based on chosen language:
            if (GameManager.instance.ChosenLanguage == GameLanguage.Polish)
            {
                introFilePath = Application.streamingAssetsPath + "/Resources/TextData/intro_pl.json";
            }
            else
            {
                introFilePath = Application.streamingAssetsPath + "/Resources/TextData/intro_eng.json";
            }
            introText = LoadIntroTextFromFile(introFilePath);
            if (introText == null)
            {
                // file with intro text doesn't exist - create new intro text data:
                introText = new IntroText(CreateTestData());
                SaveGoalsDataToFile(introText, introFilePath);
            }
            // play intro:
            introHasEnded = false;
            float showOffTime = 1.3f, fadeTime = 2.5f;

            introTextUI.GetComponent <CanvasGroup>().alpha = 0.0f;
            StartCoroutine(PlayIntroduction(showOffTime, fadeTime));
            audioSource = GetComponent <AudioSource>();
            StartCoroutine(PlayBackgroundSounds(CalculateTextDuration(introText) + introText.Content.Count * (showOffTime + fadeTime), 1.0f));
        }
Beispiel #7
0
        public override void Load() //hooking time!
        {
            introText       = new IntroText();
            customResources = new UserInterface();
            customResources.SetState(introText);

            lifeBar            = new LifeBar();
            customResourcesBar = new UserInterface();
            customResourcesBar.SetState(lifeBar);

            On.Terraria.Player.Update_NPCCollision += PlatformCollision;
            On.Terraria.Main.DrawInterface         += DrawBlingBlingBoy;
            On.Terraria.Player.PlaceThing          += PlacementRestriction;

            IL.Terraria.Projectile.VanillaAI += GrapplePlatforms;
            IL.Terraria.Main.DoDraw          += DrawWater;
        }
Beispiel #8
0
 void Awake()
 {
     playerscript = GameObject.FindGameObjectWithTag("Player").GetComponent <MCMovement>();
     invent       = (InventParent)Object.FindObjectOfType(typeof(InventParent));
     textbox      = (IntroText)Object.FindObjectOfType(typeof(IntroText));
 }
Beispiel #9
0
 void Start()
 {
     gravity   = GameObject.FindObjectOfType <Gravity> ();
     introText = GameObject.FindObjectOfType <IntroText> ();
 }
 void Start()
 {
     gravity = GameObject.FindObjectOfType<Gravity> ();
     introText = GameObject.FindObjectOfType<IntroText> ();
 }