Beispiel #1
0
    public void NextActiveSet(string setName)
    {
        if (newSet != null)
        {
            newSet.CloseSet();
        }

        switch (setName)
        {
        case "Intro":
            newSet = SetManager.OpenSet <SplashIntroSet>();
            break;

        case "Main Menu":
            newSet = SetManager.OpenSet <MainMenuSet>();
            break;

        case "Tutorial":
            newSet = SetManager.OpenSet <TutorialSet>();
            break;

        case "Game Set":
            newSet = SetManager.OpenSet <GamePanelSet>();
            break;

        case "Summary":
            newSet = SetManager.OpenSet <SummarySet>();
            break;
        }

        newSet.transform.SetParent(Holder.transform, false);
    }
Beispiel #2
0
        private void UpdateSet()
        {
            SetManager.UpdateLevels();

            ((JArray)SetManager.Meta["passed"]).ReplaceAll(SetManager.Levels);
            SetManager.Meta.Save();
        }
 // DEBUG: These are just for testing menu flow
 public void OnBackButtonClicked()
 {
     clickSound.Play();
     // Levels.CloseLevel();
     CloseSet();
     SetManager.OpenSet <MainMenuSet>();
 }
Beispiel #4
0
        public static IEnumerable <Set> Sets(this Game game)
        {
            var ret = SetManager.Get().GetByGameId(game.Id);

            return(ret);
            //return SetManager.Get().Sets.Where(x => x.GameId == game.Id);
        }
 public void OnPlayClicked()
 {
     //  clickSound.Play();
     CloseSet();
     gameRunNow = true;
     SetManager.OpenSet <GameSet>();
     // gameSetShown = true;
 }
 // DEBUG: These are just for testing menu flow
 public void OnHelpClicked()
 {
     clickSound.Play();
     Debug.Log("AUDIO");
     //gameSetShown = true;
     CloseSet();
     SetManager.OpenSet <HelpSet>();
 }
 private void Update()
 {
     if (!movie.isPlaying)
     {
         Game.Inst.levelSelect = SetManager.OpenSet <LevelSelectionSet>((lss) => Game.Inst.WantsToBeInWaitState = true);
         Destroy(gameObject);
     }
 }
    public void OnExitGame()
    {
        Game.Inst.WantsToBeInWaitState = true;
        // Levels.CloseLevel();

        CloseSet();
        SetManager.OpenSet <MainMenuSet>();
    }
    public void OnSettingsClicked()
    {
        clickSound.Play();
        Game.Inst.WantsToBeInWaitState = true;
        // Levels.CloseLevel();

        CloseSet();
        SetManager.OpenSet <MainMenuSet>();
    }
        public static string GetFullName(this Pack pack)
        {
            var set = SetManager.Get().GetById(pack.SetId);

            if (set == null)
            {
                return(null);
            }
            return(set.Name + ", " + pack.Name);
        }
Beispiel #11
0
        public static string GetFullName(this Pack pack)
        {
            var set = SetManager.Get().GetById(pack.SetId);

            //var set = SetManager.Get().Sets.FirstOrDefault(x => x.Packs.Any(y => y.Id == pack.Id));
            if (set == null)
            {
                return(null);
            }
            return(set.Name + ", " + pack.Name);
        }
Beispiel #12
0
 private void Awake()
 {
     if (active != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         active = this;
     }
 }
Beispiel #13
0
 public void RenameLevel(string name)
 {
     if (SetManager.Levels.Contains(name))
     {
         inputLevel.text = LevelManager.Level.ShortName;
     }
     else
     {
         LevelManager.Level.MoveTo(SetManager.GetLevelFullName(name));
         ListLevels(name);
     }
 }
    //Lose Sequence when player is killed
    IEnumerator LoseSequence()
    {
        yield return(new WaitForSeconds(1f));

        // Game.Inst.WantsToBeInWaitState = true;
        CloseSet();
        SetManager.OpenSet <LoseSet>();
        playerIsDead = true;
        yield return(new WaitForSeconds(3f));

        Levels.CloseLevel();
    }
Beispiel #15
0
        private void CardSelected(object sender, SearchCardImageEventArgs e)
        {
            if (e.Image == null)
            {
                return;
            }
            selection = e.Image;
            set_id    = e.SetId;
            var cardid = e.CardId;
            var set    = SetManager.Get().GetById(e.SetId);
            var card   = set.Cards.FirstOrDefault(x => x.Id == cardid);

            cardImageControl.Card.SetCard(card.Clone());
        }
Beispiel #16
0
        public void DeleteLevel()
        {
            LevelManager.Level.Delete();

            if (SetManager.Levels.Count > 2)
            {
                ListLevels(string.Empty);
            }
            else
            {
                SetManager.Delete();
                UIUtility.Main.LoadScene("Home");
            }
        }
Beispiel #17
0
        public void RenameSet(string name)
        {
            string path = SetManager.FullCategory + "\\" + name;

            if (Directory.Exists(path))
            {
                inputSet.text = SetManager.Name;
            }
            else
            {
                SetManager.MoveTo(path);
                LevelManager.Load(LevelManager.Level.ShortName);
            }
        }
        public string DispatchCommand(string[] command)
        {
            if (command[0].ToLower() == "addemployee" && command.Length == 4)
            {
                return(AddEmployee.Execute(command));
            }

            if (command[0].ToLower() == "setbirthday" && command.Length == 4)
            {
                return(SetBirthday.Execute(command));
            }

            if (command[0].ToLower() == "setaddress" && command.Length >= 3 && char.IsNumber(command[1], 0))
            {
                return(SetAddress.Execute(command));
            }

            if (command[0].ToLower() == "employeeinfo" && command.Length == 2)
            {
                return(EmployeeInfo.Execute(command));
            }

            if (command[0].ToLower() == "employeepersonalinfo" && command.Length == 2)
            {
                return(EmployeePersonalInfo.Execute(command));
            }

            if (command[0].ToLower() == "exit" && command.Length == 1)
            {
                return(Exit.Execute(command));
            }

            if (command[0].ToLower() == "setmanager" && command.Length == 3)
            {
                return(SetManager.Execute(command));
            }

            if (command[0].ToLower() == "managerinfo" && command.Length == 2)
            {
                return(ManagerInfo.Execute(command));
            }

            if (command[0].ToLower() == "listemployeesolderthan" && command.Length == 2)
            {
                return(ListEmployeesOlderThan.Execute(command));
            }

            return("Invalid Command");
        }
Beispiel #19
0
        private void cardImage_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (selection == null)
            {
                return;
            }
            var bim = new BitmapImage();

            bim.BeginInit();
            bim.CacheOption = BitmapCacheOption.OnLoad;
            var set = SetManager.Get().GetById(set_id);

            bim.UriSource = set.GetPictureUri(selection) ?? Game.GetCardBackUri();
            //bim.UriSource = CardModel.GetPictureUri(Game, set_id, selection);
            bim.EndInit();
            cardImage.Source = bim;
        }
Beispiel #20
0
 public static Set GetSet(this ICard card)
 {
     try
     {
         GetSetLock.EnterUpgradeableReadLock();
         Set ret = null;
         if (!CardSetIndex.TryGetValue(card.SetId, out ret))
         {
             GetSetLock.EnterWriteLock();
             ret = SetManager.Get().GetById(card.SetId);
             CardSetIndex[card.SetId] = ret;
             GetSetLock.ExitWriteLock();
         }
         return(ret);
     }
     finally
     {
         GetSetLock.ExitUpgradeableReadLock();
     }
 }
Beispiel #21
0
    public void BackToLevelSelect()
    {
        PlayerHealth.currentHealth = PlayerHealth.maxHealth;
        playerScript.playerAnim.SetBool("Dead", false);
        playerScript.playerAnim.SetBool("Idle", true);

        PlayerHealth.reset = false;

        GameObject[] sceneGO = FindObjectsOfType <GameObject>();
        foreach (GameObject obj in sceneGO)
        {
            if (obj.tag != "GameController")
            {
                Destroy(obj);
            }
        }
        Game.Inst.levelSelect = SetManager.OpenSet <LevelSelectionSet>();
        Game.Inst.dataManager.levelSelected = 0;
        Game.Inst.CurrentState = GameState.GAME_WAITING;
        Pausing();
    }
Beispiel #22
0
        private void CardSelected(object sender, SearchCardImageEventArgs e)
        {
            selection = e.Image;
            set_id    = e.SetId;
            var cardid = e.CardId;
            var bim    = new BitmapImage();

            bim.BeginInit();
            bim.CacheOption = BitmapCacheOption.OnLoad;

            try
            {
                var set  = SetManager.Get().GetById(e.SetId);
                var card = set.Cards.FirstOrDefault(x => x.Id == cardid);
                //var card = CardManager.Get().GetCardById(cardid);
                var uri = card.GetPicture();
                if (uri != null)
                {
                    bim.UriSource = new Uri(uri);
                }
                else
                {
                    bim.UriSource = Game.GetCardBackUri();
                }
                //bim.UriSource = e.Image != null ? new Uri(card.GetPicture()) : Game.GetCardBackUri();
                //bim.UriSource = e.Image != null ? CardModel.GetPictureUri(Game, e.SetId, e.Image) : Game.GetCardBackUri();
                bim.EndInit();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("Error loading picture uri from game pack: " + ex.ToString());
                bim             = new BitmapImage();
                bim.CacheOption = BitmapCacheOption.OnLoad;
                bim.BeginInit();
                bim.UriSource = new Uri(@"pack://application:,,,/Octgn;component/Resources/Front.jpg");
                bim.EndInit();
            }
            cardImage.Source = bim;
        }
Beispiel #23
0
        public static PackContent GenerateContent(this Pack pack)
        {
            var packContents      = new PackContent();
            var cardSelectionPool = pack.Set.Cards.ToList();
            var game = pack.Set.GetGame();

            // add the include cards to the set for this booster
            var includeCards =
                (
                    from qset in pack.Includes.Select(x => x.SetId)
                    .Distinct()
                    .Select(x => SetManager.Get().GetById(x))
                    from card in qset.Cards
                    join inc in pack.Includes on qset.Id equals inc.SetId
                    where card.Id == inc.Id
                    select new { Card = card, Include = inc }
                )
                .Select(picked =>
            {
                var card = new Card(picked.Card);

                foreach (var include in picked.Include.Properties)
                {
                    var property = game.CustomProperties.FirstOrDefault(x => x.Name.Equals(include.Property.Name, StringComparison.InvariantCultureIgnoreCase));
                    if (property != null)
                    {
                        card.PropertySets[""].Properties[property] = include.Value;
                    }
                }
                ;
                return(card);
            });

            cardSelectionPool.AddRange(includeCards);

            packContents.Merge(ProcessPackItems(pack, pack.Items, cardSelectionPool));
            return(packContents);
        }
Beispiel #24
0
    public void PrintWorkout()
    {
        if (setList.Count > 0)
        {
            int    currentRep   = 0;
            string exerciseText = Normalize(exerciseInput.text);


            if (string.IsNullOrEmpty(exerciseText))
            {
                print("No exercise name");
            }
            else
            {
                print(exerciseText);
            }
            foreach (GameObject s in setList)
            {
                SetManager manager    = s.GetComponent <SetManager> ();
                string     repsText   = Normalize(manager.repsInput.text.Trim());
                string     weightText = Normalize("" + manager.GetWeight());
                currentRep++;

                if (string.IsNullOrEmpty(repsText))
                {
                    print(currentRep + "  No reps");
                }
                else if (string.IsNullOrEmpty(weightText))
                {
                    print(currentRep + "  No weight");
                }
                else
                {
                    print(currentRep + ". Reps: " + repsText + "| Weight: " + weightText);
                }
            }
        }
    }
Beispiel #25
0
 private void LoadDatabase()
 {
     this.UpdateStatus("Loading games...");
     foreach (var g in GameManager.Get().Games)
     {
         Log.DebugFormat("Loaded Game {0}", g.Name);
     }
     this.UpdateStatus("Loading sets...");
     foreach (var s in SetManager.Get().Sets)
     {
         Log.DebugFormat("Loaded Set {0}", s.Name);
     }
     this.UpdateStatus("Loading scripts...");
     foreach (var s in DbContext.Get().Scripts)
     {
         Log.DebugFormat("Loading Script {0}", s.Path);
     }
     this.UpdateStatus("Loading proxies...");
     foreach (var p in DbContext.Get().ProxyDefinitions)
     {
         Log.DebugFormat("Loading Proxy {0}", p.Key);
     }
     this.UpdateStatus("Loaded database.");
 }
Beispiel #26
0
 private void Awake()
 {
     instance = this;
 }
 public static Set GetSet(this ICard card)
 {
     return(SetManager.Get().GetById(card.SetId));
     //return SetManager.Get().Sets.FirstOrDefault(x => x.Id == card.SetId);
 }
Beispiel #28
0
        private void LoadDatabase()
        {
            this.UpdateStatus("Loading games...");
            foreach (var g in GameManager.Get().Games)
            {
                Log.DebugFormat("Loaded Game {0}", g.Name);
            }
            this.UpdateStatus("Loading sets...");
            foreach (var s in SetManager.Get().Sets)
            {
                Log.DebugFormat("Loaded Set {0}", s.Name);
            }
            this.UpdateStatus("Loading scripts...");
            foreach (var s in DbContext.Get().Scripts)
            {
                Log.DebugFormat("Loading Script {0}", s.Path);
            }
            this.UpdateStatus("Loading proxies...");
            foreach (var p in DbContext.Get().ProxyDefinitions)
            {
                Log.DebugFormat("Loading Proxy {0}", p.Key);
            }
            this.UpdateStatus("Loaded database.");

            this.UpdateStatus("Migrating Images...");
            try
            {
                foreach (var g in GameManager.Get().Games)
                {
                    this.UpdateStatus(String.Format("Migrating {0} Images...", g.Name));
                    foreach (var s in g.Sets())
                    {
                        var gravePath = Config.Instance.Paths.GraveyardPath;
                        if (!Directory.Exists(gravePath))
                        {
                            Directory.CreateDirectory(gravePath);
                        }
                        var dir    = new DirectoryInfo(s.PackUri);
                        var newDir = new DirectoryInfo(s.ImagePackUri);
                        foreach (var f in dir.GetFiles("*.*"))
                        {
                            var newLocation = Path.Combine(newDir.FullName, f.Name);
                            f.MegaCopyTo(newLocation);
                            f.MoveTo(Path.Combine(gravePath, f.Name));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Log.Warn("Migrate Files error", e);
                TopMostMessageBox.Show(
                    "There was an error migrating your image files. Restarting your computer may help",
                    "Error",
                    MessageBoxButton.OK,
                    MessageBoxImage.Warning);
            }
            this.UpdateStatus("Migrated Images");

            this.UpdateStatus("Clearing Old Proxies...");
            try
            {
                foreach (var g in GameManager.Get().Games)
                {
                    this.UpdateStatus(String.Format("Clearing {0} Proxies...", g.Name));
                    foreach (var s in g.Sets())
                    {
                        var dir = new DirectoryInfo(s.ProxyPackUri);
                        if (dir.Exists)
                        {
                            var gravePath = Config.Instance.Paths.GraveyardPath;
                            if (!Directory.Exists(gravePath))
                            {
                                Directory.CreateDirectory(gravePath);
                            }
                            foreach (var f in dir.GetFiles("*.*"))
                            {
                                f.MoveTo(Path.Combine(gravePath, f.Name));
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Log.Warn("Clearing Old Proxies error", e);
                TopMostMessageBox.Show(
                    "There was an error clearing your old proxies. Restarting your computer may help",
                    "Error",
                    MessageBoxButton.OK,
                    MessageBoxImage.Warning);
            }
            this.UpdateStatus("Cleared Old Proxies");

            this.UpdateStatus("Clearing Old Installers...");
            try
            {
                var rpath     = new DirectoryInfo(Config.Instance.Paths.BasePath);
                var gravePath = Config.Instance.Paths.GraveyardPath;
                if (!Directory.Exists(gravePath))
                {
                    Directory.CreateDirectory(gravePath);
                }
                foreach (var f in rpath.GetFiles("OCTGN-Setup-*.exe"))
                {
                    if (f.Name.Contains(Const.OctgnVersion.ToString()))
                    {
                        continue;
                    }
                    f.MoveTo(Path.Combine(gravePath, f.Name));
                }
            }
            catch (Exception e)
            {
                Log.Warn("Clearing Old Installers error", e);
                TopMostMessageBox.Show(
                    "There was an error clearing old installers. Restarting your computer may help",
                    "Error",
                    MessageBoxButton.OK,
                    MessageBoxImage.Warning);
            }
            this.UpdateStatus("Cleared Old Installers");
        }
Beispiel #29
0
 public static Set Set(this Pack pack)
 {
     return(SetManager.Get().GetById(pack.SetId));
 }
Beispiel #30
0
        public static IEnumerable <Set> Sets(this Game game)
        {
            var ret = SetManager.Get().GetByGameId(game.Id);

            return(ret);
        }