Пример #1
0
        public void BasicInitialisationSpecifiedValues(int number, string name, string desc)
        {
            //// Arrange
            PlayerPrefs.DeleteAll();
            var gameConfiguration = ScriptableObject.CreateInstance <GameConfiguration>();
            var messenger         = new Messenger();


            //// Act
            var player = ScriptableObject.CreateInstance <Player>();

            player.Initialise(gameConfiguration, null, messenger,
                              number, LocalisableText.CreateNonLocalised(name), LocalisableText.CreateNonLocalised(desc),
                              identifierBase: "Test_Should_Not_Override", identifierBasePrefs: "T");

            //// Assert
            Assert.IsNotNull(player, "GameItem not setup.");
            Assert.AreEqual(number, player.Number, "Number not set correctly");
            Assert.AreEqual(name, player.Name, "Name not set correctly");
            Assert.AreEqual(desc, player.Description, "Description not set correctly");
            Assert.AreEqual("Player", player.IdentifierBase, "IdentifierBase not set correctly");
            Assert.AreEqual("P", player.IdentifierBasePrefs, "IdentifierBasePrefs not set correctly");
            Assert.AreEqual(0, player.Score, "Score not set correctly");
            Assert.AreEqual(0, player.Coins, "Coins not set correctly");
            Assert.AreEqual(0, player.HighScore, "HighScore not set correctly");
            Assert.AreEqual(false, player.IsBought, "IsBought not set correctly");
            Assert.AreEqual(false, player.IsUnlocked, "IsUnlocked not set correctly");
            Assert.AreEqual(false, player.IsUnlockedAnimationShown, "IsUnlockedAnimationShown not set correctly");

            Assert.AreEqual(3, player.Lives, "Lives not set correctly");
            Assert.AreEqual(1, player.Health, "Health not set correctly");
            Assert.AreEqual(false, player.IsGameWon, "IsGameWon not set correctly");
        }
Пример #2
0
        public void InitialisationBasicSpecifiedValues(int number, string name, string desc, string identifierBase, string identifierBasePrefs)
        {
            //// Arrange
            PlayerPrefs.DeleteAll();
            var gameConfiguration = ScriptableObject.CreateInstance <GameConfiguration>();
            var messenger         = new Messenger();
            var player            = ScriptableObject.CreateInstance <Player>();

            player.Initialise(gameConfiguration, null, messenger, 1);

            //// Act
            var gameItem = ScriptableObject.CreateInstance <GameItem>();

            gameItem.Initialise(gameConfiguration, player, messenger,
                                number, LocalisableText.CreateNonLocalised(name), LocalisableText.CreateNonLocalised(desc),
                                identifierBase: identifierBase, identifierBasePrefs: identifierBasePrefs);

            //// Assert
            Assert.IsNotNull(gameItem, "GameItem not setup.");
            Assert.AreEqual(number, gameItem.Number, "Number not set correctly");
            Assert.AreEqual(name, gameItem.Name, "Name not set correctly");
            Assert.AreEqual(desc, gameItem.Description, "Description not set correctly");
            Assert.AreEqual(identifierBase, gameItem.IdentifierBase, "IdentifierBase not set correctly");
            Assert.AreEqual(identifierBasePrefs, gameItem.IdentifierBasePrefs, "IdentifierBasePrefs not set correctly");
            Assert.AreEqual(0, gameItem.Score, "Score not set correctly");
            Assert.AreEqual(0, gameItem.Coins, "Coins not set correctly");
            Assert.AreEqual(0, gameItem.HighScore, "HighScore not set correctly");
            Assert.AreEqual(false, gameItem.IsBought, "IsBought not set correctly");
            Assert.AreEqual(false, gameItem.IsUnlocked, "IsUnlocked not set correctly");
            Assert.AreEqual(false, gameItem.IsUnlockedAnimationShown, "IsUnlockedAnimationShown not set correctly");
        }
    public void CustomDialog()
    {
        var dialogInstance = DialogManager.Instance.Create();

        dialogInstance.Show(title: "Test Title",
                            text: "Custom Dialog - This uses autogenerated text buttons. You can also create dialogs with custom images.",
                            doneCallback: DoneCallback,
                            buttonText: new [] { LocalisableText.CreateNonLocalised("Button 1"), LocalisableText.CreateNonLocalised("Button 2"), },
                            dialogButtons: DialogInstance.DialogButtonsType.Cancel);
    }
Пример #4
0
        /// <summary>
        /// Setup default values
        /// </summary>
        protected BuyGameItemButton(string localisationBase)
        {
            _localisationBase = localisationBase;

            ConfirmTitleText = new LocalisableText {
                IsLocalised = true, Data = _localisationBase + ".Buy.Title"
            };
            ConfirmText1 = new LocalisableText {
                IsLocalised = true, Data = _localisationBase + ".Buy.Text1"
            };
            ConfirmText2            = LocalisableText.CreateNonLocalised();
            ConfirmDialogSpriteType = UnlockGameItemButton.DialogSpriteType.FromGameItem;
        }
Пример #5
0
        public void BasicInitialisationSpecifiedValues(string number, string name, string desc)
        {
            //// Arrange
            PlayerPrefs.DeleteAll();
            var gameConfiguration = ScriptableObject.CreateInstance <GameConfiguration>();
            var messenger         = new Messenger();
            var player            = ScriptableObject.CreateInstance <Player>();

            player.Initialise(gameConfiguration, null, messenger, "1");

            //// Act
            var gameItem = ScriptableObject.CreateInstance <Level>();

            gameItem.Initialise(gameConfiguration, player, messenger,
                                number, LocalisableText.CreateNonLocalised(name), LocalisableText.CreateNonLocalised(desc),
                                identifierBase: "Test_Should_Not_Override", identifierBasePrefs: "T");

            //// Assert
            Assert.IsNotNull(gameItem, "GameItem not setup.");
            Assert.AreEqual(number, gameItem.GiId, "Number not set correctly");
            Assert.AreEqual(name, gameItem.Name, "Name not set correctly");
            Assert.AreEqual(desc, gameItem.Description, "Description not set correctly");
            Assert.AreEqual("Level", gameItem.IdentifierBase, "IdentifierBase not set correctly");
            Assert.AreEqual("L", gameItem.IdentifierBasePrefs, "IdentifierBasePrefs not set correctly");
            Assert.AreEqual(0, gameItem.Score, "Score not set correctly");
            Assert.AreEqual(0, gameItem.Coins, "Coins not set correctly");
            Assert.AreEqual(0, gameItem.HighScore, "HighScore not set correctly");
            Assert.AreEqual(false, gameItem.IsBought, "IsBought not set correctly");
            Assert.AreEqual(false, gameItem.IsUnlocked, "IsUnlocked not set correctly");
            Assert.AreEqual(false, gameItem.IsUnlockedAnimationShown, "IsUnlockedAnimationShown not set correctly");

            Assert.AreEqual(3, gameItem.StarsTotalCount, "StarTotalCount not set correctly");
            Assert.AreEqual(10, gameItem.Star1Target, "Star1Target not set correctly");
            Assert.AreEqual(15, gameItem.Star2Target, "Star2Target not set correctly");
            Assert.AreEqual(20, gameItem.Star3Target, "Star3Target not set correctly");
            Assert.AreEqual(25, gameItem.Star4Target, "Star4Target not set correctly");
            Assert.AreEqual(0, gameItem.TimeTarget, "TimeTarget not set correctly");
            Assert.AreEqual(0, gameItem.ScoreTarget, "ScoreTarget not set correctly");
            Assert.AreEqual(0, gameItem.CoinTarget, "CoinTarget not set correctly");

            Assert.AreEqual(0, gameItem.StarsWon, "StarsWon not set correctly");
            Assert.AreEqual(0, gameItem.TimeBest, "TimeBest not set correctly");
            Assert.AreEqual(0, gameItem.ProgressBest, "ProgressBest not set correctly");
        }
 // set defaults from constructor.
 public ShowGameItemCounter()
 {
     _text = LocalisableText.CreateNonLocalised("{0}");
 }