Ejemplo n.º 1
0
        public DataManager(Game game)
            : base(game)
        {
            _switches = new SwitchCollection();
            _variables = new VariableCollection();
            _achievementsToCreate = new Stack<Achievement>();

            _switches["Achievement Test"] = new Switch()
            {
                Name = "Achievement Test"
            };
            _switches["switch_ponies"] = new Switch()
            {
                Name = "Multi Switch Check Test"
            };

            _switches["Achievement Test"].TurnOn();
            PlayerName = new Variable("Pinkie Pie");
            PlayerGold = new Variable(1000);
            PlayerSteps = new Variable(0);
            PlayerName.Value = "Pinkie Pie";
            _variables["{steps_taken}"] = PlayerSteps;
            _variables["{profilename}"] = PlayerName;
            _variables["{gold}"] = PlayerGold;
        }
Ejemplo n.º 2
0
        public DataManager(Game game)
            : base(game)
        {
            _switches = new SwitchCollection();
            _variables = new VariableCollection();

            _switches["Achievement Test"] = new Switch()
            {
                Name = "Achievement Test"
            };
            _switches["switch_ponies"] = new Switch()
            {
                Name = "Multi Switch Check Test"
            };

            _playerParty = new BattleDataCollection();
            _playerCharacters = new BattleDataCollection();
            _enemyCollection = new BattleDataCollection();

            _switches["Achievement Test"].TurnOn();
            PlayerName = new Variable("Pinkie Pie");
            PlayerGold = new Variable(1000);
            PlayerSteps = new Variable(0);
            PlayerName.Value = "Pinkie Pie";
            _variables["{steps_taken}"] = PlayerSteps;
            _variables["{profilename}"] = PlayerName;
            _variables["{gold}"] = PlayerGold;
        }
Ejemplo n.º 3
0
        public override void Initialize()
        {
            base.Initialize();

            using (System.IO.Stream stream =
                System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("EquestriEngine.Resources.Data.Achievements.xml"))
            //System.IO.File.OpenRead(@"writeout.xml"))
            {
                System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(Achievement[]));
                achievements = (Achievement[])serializer.Deserialize(stream);
            }

            foreach (Achievement ach in achievements)
            {
                if (ach.DataName == null)
                    continue;
                string[] temp = ach.DataName.Split(';');
                try
                {
                    switch (temp[0])
                    {
                        case "swt":
                            if (!_switches.ContainsKey(temp[1]))
                                _switches[temp[1]] = new Switch()
                                    {
                                        Name = temp[1]
                                    };
                            ach.RegisterData(_switches[temp[1]]);
                            break;
                        case "var":
                            ach.RegisterData(_variables[temp[1]]);
                            break;
                    }
                    ach.OnAchievementUnlocked += DataChange;
                    ConsoleWindow.WriteLine("Successfully added Achievement - {0} - {1}", ach.Name, ach.Description);
                }
                catch
                {
                    ConsoleWindow.WriteLine("Warning - Adding Achievement failed: {0} - data missing", ach.Name);
                }
            }

            PlayerGold.Value = 0;

            ConsoleWindow.WriteLine("");
        }
Ejemplo n.º 4
0
 public void TurnOnSwitch(string name)
 {
     if (!_switches.ContainsKey(name))
     {
         _switches[name] = new Switch() { Name = name };
         _switches[name].TurnOn();
     }
     else
         _switches[name].TurnOn();
 }
Ejemplo n.º 5
0
 public static void ToggleSwitch(string name)
 {
     if (!_switches.ContainsKey(name))
     {
         _switches[name] = new Switch() { Name = name };
         _switches[name].Toggle();
     }
     else
         _switches[name].Toggle();
 }