Пример #1
0
    void Start()
    {
        fl = GameObject.FindObjectOfType(typeof(LevelOne)) as LevelOne;

        //hide tutorial box
        tutorialBox.GetComponent <MeshRenderer>().enabled    = true;
        tutorialBoxTwo.GetComponent <MeshRenderer>().enabled = false;

        tutorialCounterText.GetComponent <Text>().enabled = false;
        tutorialTitle.GetComponent <Text>().enabled       = true;
        tutorialUnderline.GetComponent <Text>().enabled   = true;
        tutorialMessage.GetComponent <Text>().enabled     = true;

        tutorialImage.GetComponent <Image>().enabled = true;

        //hide tutorial elements
        previousButton.GetComponent <Image>().enabled           = false;
        nextButton.GetComponent <Image>().enabled               = false;
        dismissTutorialButton.GetComponent <Image>().enabled    = true;
        dismissTutorialButtonText.GetComponent <Text>().enabled = true;

        hintButton.onClick.AddListener(onHintClick);
        nextButton.onClick.AddListener(onNextButtonClick);
        previousButton.onClick.AddListener(onPreviousButtonClick);
        dismissTutorialButton.onClick.AddListener(onDismissTutorialClick);
        //taskOne = true;
    }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     wolf.GetComponent <WolfController>().Action = true;
     wolf.GetComponent <LookAt>().Target         = player.transform;
     wolf.GetComponent <AudioSource>().Play();
 }
Пример #3
0
        /// <summary>
        /// fill buttons on twolevel panel
        /// </summary>
        /// <param name="twopanel"></param>
        /// <param name="one"></param>
        private void fillButtonsInTwoPanel(DockContent twopanel, LevelOne one, Module module)
        {
            var twos    = loadByRight.GetLevelTwos(user, set, one);
            var twoBtns = withRank.generatebuttons(twopanel,
                                                   twos.Select(t => t.Name).ToList(), twos.Select(t => t.Id).ToArray(), "leftmenu");

            foreach (var btn in twoBtns)
            {
                var two = twos.FirstOrDefault(t => t.Id == Convert.ToInt32(btn.Tag));
                //DockContent wo;
                btn.Click += (sender, e) =>
                {
                    if (works != null && works.Count > 0)
                    {
                        for (int i = 0; i < works.Count; i++)
                        {
                            if (works[i].IsDisposed)
                            {
                                works.Remove(works[i]);
                            }
                        }
                        var existed = works.FirstOrDefault(w => Convert.ToInt32(w.Tag) == two.Id);
                        if (existed != null)
                        {
                            if (existed.IsDisposed == false)
                            {
                                existed.Show(); return;
                            }
                            //else { works.Remove(existed); }
                        }
                    }

                    if (two.ClassName == null || two.ClassName == "")
                    {
                        MessageBox.Show($"未在LevelTwo中,为【{two.Name}】配置ClassName的值。");
                        return;
                    }
                    //MessageBox.Show($"use [{two.ClassName}] class to create work.");
                    var work = withType.InstanceOfType(module.AssemblyName, two.ClassName);
                    if (work == null)
                    {
                        MessageBox.Show($"类【{two.ClassName}】不存在!");
                        return;
                    }
                    if (work != null)
                    {
                        work.CurrentUser     = user;
                        work.WorkText        = two.Name;
                        work.Tag             = two.Id;
                        work.ColumnConfigXML = string.Concat(module.AssemblyName, ".xml");
                        work.ButtonTexts     = loadByRight.GetActionButtonText(user, set, two).OrderBy(r => r.Id)
                                               .ToDictionary(x => x.Name, x => x.MethodName);
                        works.Add(work);
                        work.Show(bottomPanel, DockState.Document);
                    }
                };
                twopanel.Controls.Add(btn);
            }
        }
        public MapLevelDetails(int mapWidth, int mapHeight)
        {
            LevelOne levelOne = new LevelOne();

            MapWidth  = mapWidth;
            MapHeight = mapHeight;
            Map       = levelOne.CreateMap(MapWidth, MapHeight);
        }
Пример #5
0
        /// <summary>
        /// Attempts to add the <paramref name="value"/> with the keys
        /// <paramref name="key1"/>, <paramref name="key2"/>.
        /// </summary>
        /// <param name="key1">The <typeparamref name="TKey1"/> which
        /// is the first key of the <paramref name="value"/>
        ///  to add to the <see cref="MultikeyedDictionary{TKey1, TKey2, TValue}"/>.</param>
        /// <param name="key2">The <typeparamref name="TKey2"/> which
        /// is the second key of the <paramref name="value"/>
        ///  to add to the <see cref="MultikeyedDictionary{TKey1, TKey2, TValue}"/>.</param>
        /// <param name="value">The <typeparamref name="TValue"/> to add to the <see cref="MultikeyedDictionary{TKey1, TKey2, TValue}"/></param>
        public bool TryAdd(TKey1 key1, TKey2 key2, TValue value)
        {
            // Declare the locals relative to the different levels.
            LevelOne levelOne;

            /* ------------------------------------------------------\
            |  Check each level individually, if the key set is      |
            |  already present, indicate that nothing was done, and  |
            |  yield; otherwise note that it was inserted.           |
            \------------------------------------------------------ */
            if (((object)(key1)) == null)
            {
                throw new ArgumentNullException("key1");
            }
            bool topLevelLock = false;

            Monitor.Enter(this.dataCopy, ref topLevelLock);
            if (this.dataCopy.TryGetValue(key1, out levelOne))
            {
                if (topLevelLock)
                {
                    Monitor.Exit(this.dataCopy);
                }
                if (((object)(key2)) == null)
                {
                    throw new ArgumentNullException("key2");
                }
                bool levelOneLock = false;
                Monitor.Enter(levelOne, ref levelOneLock);
                if (levelOne.ContainsKey(key2))
                {
                    if (levelOneLock)
                    {
                        Monitor.Exit(levelOne);
                    }
                    return(false);
                }
                else
                {
                    levelOne.Add(key2, value);
                    if (levelOneLock)
                    {
                        Monitor.Exit(levelOne);
                    }
                }
            }
            else
            {
                this.dataCopy.Add(key1, (levelOne = new LevelOne()));
                levelOne.Add(key2, value);
                if (topLevelLock)
                {
                    Monitor.Exit(this.dataCopy);
                }
            }
            return(true);
        }
Пример #6
0
        /// <summary>
        /// Adds the <paramref name="value"/> with the keys
        /// <paramref name="key1"/>, <paramref name="key2"/>.
        /// </summary>
        /// <param name="key1">The <typeparamref name="TKey1"/> which
        /// is the first key of the <paramref name="value"/>
        /// to add to the <see cref="MultikeyedDictionary{TKey1, TKey2, TValue}"/>.</param>
        /// <param name="key2">The <typeparamref name="TKey2"/> which
        /// is the second key of the <paramref name="value"/>
        /// to add to the <see cref="MultikeyedDictionary{TKey1, TKey2, TValue}"/>.</param>
        /// <param name="value">The <typeparamref name="TValue"/> to add to the <see cref="MultikeyedDictionary{TKey1, TKey2, TValue}"/>.</param>
        public void Add(TKey1 key1, TKey2 key2, TValue value)
        {
            // Declare the locals relative to the different levels.
            LevelOne levelOne;

            /* ------------------------------------------------------\
            |  Check each level individually, if the key set is      |
            |  already present, throw an the appropriate exception.  |
            \------------------------------------------------------ */
            if (((object)(key1)) == null)
            {
                throw new ArgumentNullException("key1");
            }
            bool topLevelLock = false;

            Monitor.Enter(this.dataCopy, ref topLevelLock);
            if (this.dataCopy.TryGetValue(key1, out levelOne))
            {
                if (topLevelLock)
                {
                    Monitor.Exit(this.dataCopy);
                }
                if (((object)(key2)) == null)
                {
                    throw new ArgumentNullException("key2");
                }
                bool levelOneLock = false;
                Monitor.Enter(levelOne, ref levelOneLock);
                if (levelOne.ContainsKey(key2))
                {
                    if (levelOneLock)
                    {
                        Monitor.Exit(levelOne);
                    }
                    throw new InvalidOperationException();
                }
                else
                {
                    levelOne.Add(key2, value);
                    if (levelOneLock)
                    {
                        Monitor.Exit(levelOne);
                    }
                }
            }
            else
            {
                this.dataCopy.Add(key1, (levelOne = new LevelOne()));
                levelOne.Add(key2, value);
                if (topLevelLock)
                {
                    Monitor.Exit(this.dataCopy);
                }
            }
        }
Пример #7
0
 // 2
 public void OnTriggerStay(Collider other)
 {
     SetCollidingObject(other);
     Debug.Log(other.tag);
     if (other.tag == "Trap")
     {
         if (Controller.GetHairTriggerDown())
         {
             LevelOne.GetIns().wolfSaved = true;
         }
     }
 }
Пример #8
0
        public void BuildMap(Type type)
        {
            ArrayList map = (ArrayList)type.GetMethod("Map").Invoke(type, new object[] {});

            for (int i = 0; i < LevelOne.Map().Count; i++)
            {
                for (int j = 0; j < ((String[])LevelOne.Map()[i]).Length; j++)
                {
                    String value = ((String[])((ArrayList)LevelOne.Map())[i])[j];
                    HandleTile(value, i, j);
                }
            }
        }
Пример #9
0
    public void OnCollisionEnter(Collision collision)
    {
        Collider other = collision.collider;

        if (other.GetComponentInParent <WolfController>() && LevelOne.GetIns().wolfSaved&&
            collision.relativeVelocity.magnitude > minVelAttack)
        {
            Debug.Log("Attcked");
            other.GetComponentInParent <WolfController>().Stun = true;
            attackedTime = Time.time;
            attacked     = true;
        }
    }
Пример #10
0
        public void Init(Game theGame, SpriteBatch spriteBatchToUse)
        {
            Levels         = new List <ILevel>();
            TheGame        = theGame;
            TheSpriteBatch = spriteBatchToUse;
            CurLevelNR     = 0;

            ILevel levelOne   = new LevelOne();
            ILevel levelTwo   = new LevelTwo();
            ILevel levelThree = new LevelThree();

            Levels.Add(levelOne);
            Levels.Add(levelTwo);
            Levels.Add(levelThree);
        }
Пример #11
0
    static void CreateDefaultObjects()
    {
        using (UnitOfWork uow = GetNewUnitOfWork()) {
            LevelOne parent1 = new LevelOne(uow);
            parent1.Text = "Nokia";

            LevelOne parent2 = new LevelOne(uow);
            parent2.Text = "Samsung";

            LevelTwo child11 = new LevelTwo(uow);
            child11.Text   = "Cellphone";
            child11.Parent = parent1;

            LevelThree grand111 = new LevelThree(uow);
            grand111.Text  = "N91";
            grand111.Owner = child11;

            LevelThree grand112 = new LevelThree(uow);
            grand112.Text  = "N8";
            grand112.Owner = child11;


            LevelTwo child21 = new LevelTwo(uow);
            child21.Text   = "Cellphone";
            child21.Parent = parent2;

            LevelThree grand211 = new LevelThree(uow);
            grand211.Text  = "Galaxy";
            grand211.Owner = child21;

            LevelThree grand212 = new LevelThree(uow);
            grand212.Text  = "Wave";
            grand212.Owner = child21;


            LevelTwo child22 = new LevelTwo(uow);
            child22.Text   = "Display";
            child22.Parent = parent2;

            LevelThree grand221 = new LevelThree(uow);
            grand221.Text  = "SyncMaster";
            grand221.Owner = child22;

            uow.CommitChanges();
        }
    }
Пример #12
0
    // Use this for initialization
    void Start()
    {
        gameMngr = GetComponent <LevelOne>();
        listMngr = listPanel.GetComponent <ListManager>();
        NavigationHistory.Add(loadingScreen);

        introPanel.SetActive(false);
        monthMenuPanel.SetActive(false);
        mergePanel.SetActive(false);
        editPanel.SetActive(false);
        quickExpensePanel.SetActive(false);
        calendar.SetActive(false);
        loadingScreen.SetActive(true);
        predictionsDate.SetActive(false);
        predictionsAmount.SetActive(false);
        listPanel.SetActive(false);
        tagListPanel.SetActive(false);
    }
Пример #13
0
        /// <summary>
        /// Initializes the game manager and sets all the levels.
        /// </summary>
        public void Initialize()
        {
            LevelOne   levelOne   = new LevelOne();
            LevelTwo   levelTwo   = new LevelTwo();
            LevelThree levelThree = new LevelThree();

            levelOne.EndOfLevel   += onEndOfLevel;
            levelTwo.EndOfLevel   += onEndOfLevel;
            levelThree.EndOfLevel += onEndOfLevel;
            levelOne.Initialize();
            levelTwo.Initialize();
            levelThree.Initialize();
            m_levels.Add(levelOne);
            m_levels.Add(levelTwo);
            m_levels.Add(levelThree);
            m_currentStage     = Stage.Introduction;
            m_oldKeyboardState = Keyboard.GetState();
        }
Пример #14
0
    // Use this for initialization
    void OnEnable()
    {
        string s = nameField.GetComponent <InputField>().text;

        if (String.IsNullOrEmpty(nameField.GetComponent <InputField>().text))
        {
            nField = nameField.GetComponent <InputField>().text = DateTime.Now.ToString();
        }
        else
        {
            nField = nameField.GetComponent <InputField>().text;
        }
        lvlOne = GameObject.Find("Canvas").GetComponent <LevelOne>();
        foreach (GameObject g in hideList)
        {
            g.SetActive(!hideMoneyButtons);
        }
    }
Пример #15
0
        /// <summary>
        /// get leveltwo list for specific user
        /// </summary>
        public List <LevelTwo> GetLevelTwos(User user, SetofBook set, LevelOne levelone)
        {
            try
            {
                using (var sc = new sysContext())
                {
                    var roleids = sc.Users.Include(u => u.Partners)
                                  .FirstOrDefault(u => u.Id == user.Id).Partners.Select(r => r.Id);
                    var rightids = sc.Rights.Include(r => r.LevelTwo.LevelOne)
                                   .Where(r => roleids.Contains(r.RoleId) &&
                                          r.SetofBookId == set.Id &&
                                          r.Enabled == true &&
                                          r.LevelTwo.LevelOne.Id == levelone.Id)
                                   .Select(r => r.Id).ToList();
                    var twos = sc.LevelTwos.Where(t => rightids.Contains(t.Id)).ToList();
                    return(twos);

                    #region waive
                    //var roles = (from u in sc.Users where u.Id == user.Id select u.SRoles).ToList();
                    //var roles = sc.Users.Find(user.Id).SRoles.ToList();
                    //var roleids = roles.Select(r => r.Id);
                    //var book = sc.SetofBooks.Find(set.Id);
                    //var rightids = sc.Accredits
                    //        .Where(a => roleids.Contains(a.RoleId)).Select(a => a.RightId).ToList();
                    //var twoids = sc.Rights.Where(r => rightids.Contains(r.Id) || r.Enabled == true).Select(r => r.LevelTwoId).ToList();
                    //var twos = sc.LevelTwos.Where(t => twoids.Contains(t.Id) || t.LevelOneId == levelone.Id).ToList();

                    //return twos;
                    #endregion
                }
            }
            catch (Exception e)
            {
                return(null);

                throw;
            }
        }
Пример #16
0
 // Use this for initialization
 void Start()
 {
     levelOne = sun.GetComponent <LevelOne>();
     counter  = 0;
 }
Пример #17
0
 // Use this for initialization
 void Start()
 {
     gameManager = GetComponent <LevelOne>();
 }
 public Giant()
 {
     movement   = new GroundMovement();
     attackType = new PunchAttack();
     level      = new LevelOne();
 }
Пример #19
0
 internal LevelZero(LevelOne levelOne)
 {
     LevelOne = levelOne;
 }
Пример #20
0
        public TopMenu GetMenuForUser(int UserId)
        {
            var result = new TopMenu {
                Id          = 0,
                DivCssClass = "navbar",
                Divisions   = new List <TopMenuDivision>()
            };
            var userObjects  = UserAccessMenuList(UserId);
            var menu1        = _context.MENU_L1.Where(m => userObjects.Any(k => k == m.object_auto) && m.active).OrderBy(m => m.sorder);
            var menu2        = _context.MENU_L2.Where(m => m.active && userObjects.Any(k => k == m.object_auto) && menu1.Any(k => k.menu_L1_auto == m.menu_L1_auto)).OrderBy(m => m.sorder);
            var menu3        = _context.MENU_L3.Where(m => m.active && userObjects.Any(k => k == m.object_auto) && menu2.Any(k => k.menu_L2_auto == m.menu_L2_auto)).OrderBy(m => m.sorder);
            var leftDivision = new TopMenuDivision {
                Id           = 1,
                DivCssClass  = "navbar-left",
                UlCssClass   = "menu-container",
                OrderIndex   = 1,
                levelOneList = new List <LevelOne>()
            };
            var rightDivision = new TopMenuDivision
            {
                Id           = 2,
                DivCssClass  = "navbar-right",
                UlCssClass   = "menu-container",
                OrderIndex   = 1,
                levelOneList = new List <LevelOne>()
            };

            foreach (var level1Menu in menu1.ToList())
            {
                var levelOne = new LevelOne
                {
                    Id            = level1Menu.menu_L1_auto,
                    isMenuNotLink = false,
                    LiCssClass    = "menu-item",
                    OrderIndex    = 0,
                    Span          = new TopMenuSpan
                    {
                        IconCssClass = "material-icons arrow",
                        IconText     = "&#xE313;",
                        OrderIndex   = level1Menu.sorder == null ? 99 : (int)level1Menu.sorder,
                        SpanText     = level1Menu.label
                    },
                    levelTwoList = new List <LevelTwo>(),
                    Link         = new TopMenuLink()
                };
                if (HasSubMenu(level1Menu.menu_L1_auto, menu2.Select(m => m.menu_L1_auto).ToList()))
                {
                    levelOne.isMenuNotLink = true;
                    foreach (var level2Menu in menu2.Where(m => m.menu_L1_auto == level1Menu.menu_L1_auto).ToList())
                    {
                        var levelTwo = new LevelTwo
                        {
                            Id            = level2Menu.menu_L2_auto,
                            isMenuNotLink = false,
                            ParentId      = level1Menu.menu_L1_auto,
                            UlCssClass    = "sub-menu-container",
                            LiCssClass    = "sub-menu-item",
                            Span          = new TopMenuSpan {
                                IconCssClass = "material-icons arrow",
                                IconText     = "&#xE313;",
                                OrderIndex   = level2Menu.sorder == null ? 99 : (int)level2Menu.sorder,
                                SpanText     = level2Menu.label
                            },
                            levelThreeList = new List <LevelThree>(),
                            Link           = new TopMenuLink()
                        };
                        if (HasSubMenu(level2Menu.menu_L2_auto, menu3.Select(m => m.menu_L2_auto).ToList()))
                        { //Level3 Links
                            levelTwo.isMenuNotLink = true;
                            foreach (var level3Menu in menu3.Where(m => m.menu_L2_auto == level2Menu.menu_L2_auto).ToList())
                            {
                                var levelThree = new LevelThree
                                {
                                    Id         = level3Menu.menu_L3_auto,
                                    ParentId   = level2Menu.menu_L2_auto,
                                    UlCssClass = "sub-menu-container",
                                    LiCssClass = "sub-menu-item",
                                    Span       = new TopMenuSpan
                                    {
                                        IconCssClass = "material-icons arrow",
                                        IconText     = "&#xE313;",
                                        OrderIndex   = level2Menu.sorder == null ? 99 : (int)level2Menu.sorder,
                                        SpanText     = level2Menu.label
                                    },
                                    Link = new TopMenuLink {
                                        Id              = level3Menu.menu_L3_auto,
                                        Text            = level3Menu.label,
                                        Href            = level3Menu.targetpath,
                                        OrderIndex      = level3Menu.sorder == null ? 99 : (int)level3Menu.sorder,
                                        OpenInNewWindow = level3Menu.new_window
                                    }
                                };
                                levelTwo.levelThreeList.Add(levelThree);
                            }
                        }
                        else //Level2 Links
                        {
                            levelTwo.Link = new TopMenuLink {
                                Id              = level2Menu.menu_L2_auto,
                                Text            = level2Menu.label,
                                Href            = level2Menu.targetpath,
                                OrderIndex      = level2Menu.sorder == null ? 99 : (int)level2Menu.sorder,
                                OpenInNewWindow = level2Menu.new_window
                            };
                        }
                        levelOne.levelTwoList.Add(levelTwo);
                    }
                }
                else //Level1 Links
                {
                    levelOne.Link = new TopMenuLink
                    {
                        Id              = level1Menu.menu_L1_auto,
                        Text            = level1Menu.label,
                        Href            = level1Menu.targetpath,
                        OrderIndex      = level1Menu.sorder == null ? 99 : (int)level1Menu.sorder,
                        OpenInNewWindow = true
                    };
                }
                if (levelOne.Id == 7 || levelOne.Id == 8)
                {
                    rightDivision.levelOneList.Add(levelOne);
                }
                else
                {
                    leftDivision.levelOneList.Add(levelOne);
                }
            }

            result.Divisions.Add(leftDivision);
            result.Divisions.Add(rightDivision);
            return(result);
        }
Пример #21
0
 // Use this for initialization
 void Awake()
 {
     listMngr = listManagerObj.GetComponent <ListManager>();
     lvlOne   = GameObject.Find("Canvas").GetComponent <LevelOne>();
     nav      = lvlOne.GetComponent <Navigation>();
 }
Пример #22
0
        static void Main(string[] args)
        {
            StartSetupScreen();

            var      world    = new World();
            LevelOne levelOne = new LevelOne();

            var fpsCounter = new FramesPerSecondCounter(world);
            var fpsWriter  = new FpsRenderer(world);

            MapLevelDetails map = new MapLevelDetails(25, 11); // initialize map

            world.Set(map);
            MapRenderer mapRenderer = new MapRenderer(world);

            Queue <string> playerMessageQueue = new Queue <string>(2);

            world.Set(playerMessageQueue);
            MessageBoxRenderer messageBoxRenderer = new MessageBoxRenderer(world);

            HealthComponent health = new HealthComponent()
            {
                Health = new RegenerateAttribute()
                {
                    Current = 27, Max = 40, Name = "Health", RegenRatePerSecond = 0.5
                }
            };
            ManaComponent mana = new ManaComponent()
            {
                Mana = new RegenerateAttribute()
                {
                    Current = 25, Max = 30, Name = "Mana", RegenRatePerSecond = 0.2
                }
            };
            ExperienceBar xpBar = new ExperienceBar();

            PlayerStats playerStats = new PlayerStats("Dave", health, mana, xpBar);

            world.Set(playerStats);
            ConsoleInputSystem   playerInput          = new ConsoleInputSystem(world);
            PlayerMovementSystem playerMovementSystem = new PlayerMovementSystem(world);
            PlayerRenderSystem   player = new PlayerRenderSystem(world);
            PlayerPosition       playerStartPosition = new PlayerPosition(map, world); //initialize player

            playerStartPosition.MoveTo(27);
            world.Set(playerStartPosition);

            MonsterMoveController[] monsters = levelOne.CreateMonsters(world, map); //initialize monsters
            world.Set(monsters);
            MonsterMovementSystem monsterMovement  = new MonsterMovementSystem(world);
            MonsterRenderSystem   monstersRenderer = new MonsterRenderSystem(world);

            List <string> combatMessagesQueue = new List <string>(3);

            world.Set(combatMessagesQueue);
            CombatHandler combatHandler = new CombatHandler(world);

            world.Set(combatHandler);
            CombatMessages combatMessages = new CombatMessages(world);

            var updateSystems = new IUpdate[] { playerInput, playerMovementSystem, combatHandler, monsterMovement, fpsCounter, health, mana }; //Order is important!
            var renderSystems = new IRender[] { player, monstersRenderer, mapRenderer, messageBoxRenderer, combatMessages, fpsCounter, fpsWriter, health, mana, xpBar };

            GameEngine gameEngine = new GameEngine(updateSystems, renderSystems, player, monstersRenderer);

            mapRenderer.PrintMap(map.Map);
            gameEngine.Start();
        }
 public Dragon()
 {
     movement   = new AirMovement();
     attackType = new FlameAttack();
     level      = new LevelOne();
 }
 static void Main()
 {
     using (var game = new LevelOne())
         game.Run();
 }
    static void Main(string[] args)
    {
        var one = new LevelOne();

        Console.WriteLine(one.LevelTwo.LevelThree.LastLevel);
    }
Пример #26
0
 /// <summary>
 /// Returns/sets the value with the <paramref name="key1"/>, <paramref name="key2"/>, <paramref name="key3"/>, <paramref name="key4"/> provided.
 /// </summary>
 /// <param name="key1">The <typeparamref name="TKey1"/> which
 /// is the first key of the element to set/retrieve.</param>
 /// <param name="key2">The <typeparamref name="TKey2"/> which
 /// is the second key of the element to set/retrieve.</param>
 /// <param name="key3">The <typeparamref name="TKey3"/> which
 /// is the third key of the element to set/retrieve.</param>
 /// <param name="key4">The <typeparamref name="TKey4"/> which
 /// is the fourth key of the element to set/retrieve.</param>
 public TValue this[TKey1 key1, TKey2 key2, TKey3 key3, TKey4 key4]
 {
     get
     {
         LevelOne   levelOne;
         LevelTwo   levelTwo;
         LevelThree levelThree;
         if (((object)(key1)) == null)
         {
             throw new ArgumentNullException("key1");
         }
         bool topLevelLock = false;
         Monitor.Enter(this.dataCopy, ref topLevelLock);
         if (this.dataCopy.TryGetValue(key1, out levelOne))
         {
             if (topLevelLock)
             {
                 Monitor.Exit(this.dataCopy);
             }
             if (((object)(key2)) == null)
             {
                 throw new ArgumentNullException("key2");
             }
             bool levelOneLock = false;
             Monitor.Enter(levelOne, ref levelOneLock);
             if (levelOne.TryGetValue(key2, out levelTwo))
             {
                 if (levelOneLock)
                 {
                     Monitor.Exit(levelOne);
                 }
                 if (((object)(key3)) == null)
                 {
                     throw new ArgumentNullException("key3");
                 }
                 bool levelTwoLock = false;
                 Monitor.Enter(levelTwo, ref levelTwoLock);
                 if (levelTwo.TryGetValue(key3, out levelThree))
                 {
                     TValue value;
                     if (levelTwoLock)
                     {
                         Monitor.Exit(levelTwo);
                     }
                     if (((object)(key4)) == null)
                     {
                         throw new ArgumentNullException("key4");
                     }
                     bool levelThreeLock = false;
                     Monitor.Enter(levelThree, ref levelThreeLock);
                     if (levelThree.TryGetValue(key4, out value))
                     {
                         if (levelThreeLock)
                         {
                             Monitor.Exit(levelThree);
                         }
                         return(value);
                     }
                     else
                     {
                         if (levelThreeLock)
                         {
                             Monitor.Exit(levelThree);
                         }
                         throw new SubKeyNotFoundException("key4");
                     }
                 }
                 else
                 {
                     if (levelTwoLock)
                     {
                         Monitor.Exit(levelTwo);
                     }
                     throw new SubKeyNotFoundException("key3");
                 }
             }
             else
             {
                 if (levelOneLock)
                 {
                     Monitor.Exit(levelOne);
                 }
                 throw new SubKeyNotFoundException("key2");
             }
         }
         else
         {
             if (topLevelLock)
             {
                 Monitor.Exit(this.dataCopy);
             }
             throw new SubKeyNotFoundException("key1");
         }
     }
     set
     {
         LevelOne   levelOne;
         LevelTwo   levelTwo;
         LevelThree levelThree;
         if (((object)(key1)) == null)
         {
             throw new ArgumentNullException("key1");
         }
         bool topLevelLock = false;
         Monitor.Enter(this.dataCopy, ref topLevelLock);
         if (this.dataCopy.TryGetValue(key1, out levelOne))
         {
             if (topLevelLock)
             {
                 Monitor.Exit(this.dataCopy);
             }
             if (((object)(key2)) == null)
             {
                 throw new ArgumentNullException("key2");
             }
             bool levelOneLock = false;
             Monitor.Enter(levelOne, ref levelOneLock);
             if (levelOne.TryGetValue(key2, out levelTwo))
             {
                 if (levelOneLock)
                 {
                     Monitor.Exit(levelOne);
                 }
                 if (((object)(key3)) == null)
                 {
                     throw new ArgumentNullException("key3");
                 }
                 bool levelTwoLock = false;
                 Monitor.Enter(levelTwo, ref levelTwoLock);
                 if (levelTwo.TryGetValue(key3, out levelThree))
                 {
                     if (levelTwoLock)
                     {
                         Monitor.Exit(levelTwo);
                     }
                     if (((object)(key4)) == null)
                     {
                         throw new ArgumentNullException("key4");
                     }
                     bool levelThreeLock = false;
                     Monitor.Enter(levelThree, ref levelThreeLock);
                     if (levelThree.ContainsKey(key4))
                     {
                         if (levelThreeLock)
                         {
                             Monitor.Exit(levelThree);
                         }
                         levelThree[key4] = value;
                     }
                     else
                     {
                         levelThree.Add(key4, value);
                         if (levelThreeLock)
                         {
                             Monitor.Exit(levelThree);
                         }
                     }
                 }
                 else
                 {
                     levelTwo.Add(key3, (levelThree = new LevelThree()));
                     levelThree.Add(key4, value);
                     if (levelTwoLock)
                     {
                         Monitor.Exit(levelTwo);
                     }
                 }
             }
             else
             {
                 levelOne.Add(key2, (levelTwo = new LevelTwo()));
                 levelTwo.Add(key3, (levelThree = new LevelThree()));
                 levelThree.Add(key4, value);
                 if (levelOneLock)
                 {
                     Monitor.Exit(levelOne);
                 }
             }
         }
         else
         {
             this.dataCopy.Add(key1, (levelOne = new LevelOne()));
             levelOne.Add(key2, (levelTwo = new LevelTwo()));
             levelTwo.Add(key3, (levelThree = new LevelThree()));
             levelThree.Add(key4, value);
             if (topLevelLock)
             {
                 Monitor.Exit(this.dataCopy);
             }
         }
     }
 }
Пример #27
0
 // save level 1 state to file
 public static void SaveLevelOne(LevelOne level) => Save(level.CurrentState,
                                                         Path.Combine(Application.persistentDataPath, LEVEL_ONE_SAVE_FILE));
Пример #28
0
 public LevelTwo(LevelOne levelOne, string text) : base(text) => LevelOne = levelOne;
 static void Main()
 {
     using (var game = new LevelOne())
         game.Run();
 }
Пример #30
0
 public LevelZero(LevelOne levelOne)
 {
     this._levelOne = levelOne;
 }
 private void Step1()
 {
     ExceptionHandler.AppendCatchExceptionTypes(typeof(WxeUserCancelException));
     RootObject = ObjectFactory.Create <LevelOne>();
 }