コード例 #1
0
ファイル: WatcherSymbol.cs プロジェクト: hombrevrc/FDK
        internal void Update(SingleAdviser <int> firstAdviser, SingleAdviser <int> secondAdviser)
        {
            Level2 f = firstAdviser.GetLevel2(m_symbol);
            Level2 s = secondAdviser.GetLevel2(m_symbol);

            if (!f.Exist || !s.Exist)
            {
                return;
            }
            if (!f.HasBeenChanged && !s.HasBeenChanged)
            {
                return;
            }
            int key = StrategyPairTransactionInfo.GetKey(firstAdviser.Tag, secondAdviser.Tag);
            StrategyPairTransactionInfo sPairs = null;

            if (!dictSPairs.TryGetValue(key, out sPairs))
            {
                sPairs = new StrategyPairTransactionInfo();
                {
                    dictSPairs.Add(key, sPairs);
                }
            }

            Run(firstAdviser, secondAdviser, s, f, ref sPairs.m_firstBidSecondAskArbitrage);
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: SayanSuresh/gamesayan
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here

            // Load level
            //Tile.Content = Content;
            lv1   = new Level1(Content);
            lv2   = new Level2(Content);
            level = lv1;

            // Load menu content
            btnPlay.Load(Content.Load <Texture2D>("Menu/start_normal"), new Vector2(280, 150));
            btnQuit.Load(Content.Load <Texture2D>("Menu/quit_normal"), new Vector2(300, 280));
            deadTextTexture   = Content.Load <Texture2D>("Menu/deadText");
            deadTextRectangle = new Rectangle(100, 0, deadTextTexture.Width, deadTextTexture.Height);

            camera = new Camera(GraphicsDevice.Viewport);

            // Load players content
            textureHero = Content.Load <Texture2D>("Players/thief");

            initialzeGameObjects();
        }
コード例 #3
0
    public MainWindow()
    {
        InitializeComponent();

        lvl2 = new Level2();
        lvl2.CounterUpdated += UpdateCounterText;
    }
コード例 #4
0
 public Level2OrderBook(Level2 parent, string symbol) : base(parent, symbol, false, parent is Level2Direct)
 {
     this.parent                 = parent;
     base.parent                 = parent;
     this.dataProvider           = parent;
     this.IsPresentationDisabled = true;
 }
コード例 #5
0
        public Game1()
        {
            FileHandler.writeToFile(systemOptions, @"Content\Data\system_variables.xml", new XmlSerializer(typeof(SystemOptions)));
            systemOptions = FileHandler.readFromFile(@"Content\Data\system_variables.xml", new XmlSerializer(typeof(SystemOptions)));

            new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth  = systemOptions.resolutionWidth,
                PreferredBackBufferHeight = systemOptions.resolutionHeight,
                IsFullScreen = systemOptions.fullScreen
            };

            Components.Add(new InputHandler(this));
            stateManager = new GameStateManager(this);
            Components.Add(stateManager);

            screenRectangle         = new Rectangle(0, 0, systemOptions.resolutionWidth, systemOptions.resolutionHeight);
            startMenuScreen         = new StartMenuScreen(this, stateManager);
            Level1                  = new Level1(this, stateManager);
            Level2                  = new Level2(this, stateManager);
            characterCreationScreen = new CharacterCreationScreen(this, stateManager);
            pauseScreen             = new PauseScreen(this, stateManager);
            optionsScreen           = new OptionsScreen(this, stateManager);
            loadGameScreen          = new LoadGameScreen(this, stateManager);
            gameLoseScreen          = new GameLoseScreen(this, stateManager);
            lobbyScreen             = new LobbyScreen(this, stateManager);
            highScoreScreen         = new HighScoresScreen(this, stateManager);

            stateManager.ChangeState(startMenuScreen);
        }
コード例 #6
0
ファイル: Leanback.cs プロジェクト: x16755/Final
    // Update is called once per frame
    private void FixedUpdate()
    {
        position     = transform.position; positionX = position.x; positionY = position.y; positionZ = position.z;
        ResponseTime = GameObject.FindGameObjectWithTag("ResponseTime").GetComponent <ResponseTime>();
        Level2       = GameObject.FindGameObjectWithTag("Player").GetComponent <Level2>();
        frame        = Time.frameCount;
        clock       += Time.deltaTime * 1;

        if (positionZ >= forward)
        {
            transform.GetChild(0).gameObject.SetActive(true);
            if (!lean)
            {
                StreamWriter sw = File.AppendText(Variables.folder + "Error_Count_Participant" + Variables.participant + ".csv");
                sw.WriteLine(Error + "," + Level2.Trial + "," + ResponseTime.Trial + "," + frame + "," + ResponseTime.levelTimer + "," + clock);
                sw.Close();
                lean = true;
                Error++;
            }
        }
        else
        {
            lean = false;
            transform.GetChild(0).gameObject.SetActive(false);
        }
    }
コード例 #7
0
        static void Main(string[] args)
        {
            int x = default(int);

            Console.WriteLine("The default value is " + x);
            Console.WriteLine();

            Form myForm = default(Form);

            Console.WriteLine("Is the default value for Form is null? " + (myForm == null));
            Console.WriteLine();

            //The default vaule for enum is decided by the numeric order. The first value is the default value.
            Level1 l1 = default(Level1);

            Console.WriteLine("The default value is " + l1);
            Console.WriteLine();

            //The default vaule for enum could be changed by giving different values to different levels.
            Level2 l2 = default(Level2);

            Console.WriteLine("The default value is " + l2);
            Console.WriteLine();

            //If the levels in enum does not have a value of "0", there will be a problem.
            Level3 l3 = default(Level3);

            Console.WriteLine("The default value is " + l3);
            Console.WriteLine();
        }
コード例 #8
0
        public void CloneClassWorks()
        {
            var source = new Level1();
            for (int i = 0; i < 3; i++)
            {
                var l2 = new Level2();
                for (int j = 0; j < 5; j++)
                {
                    l2.Level3s.Add(new Level3 { Value = j });
                }

                source.Level2s.Add(l2);
            }

            var dest = ReflectionClone.DeepCopy(source);

            Assert.AreEqual(source.Name, dest.Name);
            Assert.AreEqual(source.Num, dest.Num);

            for (int i = 0; i < source.Level2s.Count; i++)
            {
                Assert.AreEqual(source.Level2s[i].SomeField, dest.Level2s[i].SomeField);
                for (int j = 0; j < source.Level2s[i].Level3s.Count; j++)
                {
                    Assert.AreEqual(source.Level2s[i].Level3s[j].Value, dest.Level2s[i].Level3s[j].Value);
                }
            }
        }
コード例 #9
0
    public MainWindow()
    {
        InitializeComponent();

        lvl2        = new Level2();
        DataContext = lvl2;
    }
コード例 #10
0
ファイル: TestApplication.cs プロジェクト: AGGP-NHTI/AGGP131c
        public void Test()
        {
            Level1  L1  = new Level1();
            Level2  L2  = new Level2();
            Level3  L3  = new Level3();
            Level4A L4A = new Level4A();
            Level4B L4B = new Level4B();

            Console.WriteLine("TEST APPLICATION");

            Console.WriteLine("\nTESTING Level1");
            L1.Method1();

            Console.WriteLine("\nTESTING Level2");
            L2.Method1();
            L2.Method2();

            Console.WriteLine("\nTESTING Level3");
            L3.Method1();
            L3.Method2();
            L3.Method3();

            Console.WriteLine("\nTESTING Level4A");
            L4A.Method1();
            L4A.Method2();
            L4A.Method3();

            Console.WriteLine("\nTESTING Level4B");
            L4B.Method1();
            L4B.Method2();
            L4B.Method3();

            Pause();
        }
コード例 #11
0
ファイル: Game1.cs プロジェクト: mcbe1985/2D_Game_GameDev
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            hero       = new Hero(Content, new Vector2(178, 100));
            hero.input = new BedieningPijltjes();


            myBackground = Content.Load <Texture2D>("png/BG");
            mainFrame    = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);

            menuImage     = Content.Load <Texture2D>("png/BGMenu");
            wonImage      = Content.Load <Texture2D>("png/BGWON");
            diedImage     = Content.Load <Texture2D>("png/BGDead");
            controlsImage = Content.Load <Texture2D>("png/BGControls");
            infoImage     = Content.Load <Texture2D>("png/BGInfo");

            level1 = new Level1(Content, hero);
            level1.CreateLevel(Content);

            level2 = new Level2(Content, hero);
            level2.CreateLevel(Content);

            levelBeginner = new BeginnerLevel1(Content, hero);
            levelBeginner.CreateLevel(Content);

            camera = new Camera();

            backgroundMusic = Content.Load <Song>("Background");
            MediaPlayer.Play(backgroundMusic);
            MediaPlayer.IsRepeating = true;
        }
コード例 #12
0
ファイル: Box.cs プロジェクト: alirahal22/4-Bash
    private void OnCollisionEnter(Collision collision)
    {
        int player = Convert.ToInt32(collision.transform.tag);

        Level2.collectPoints(player);
        Destroy(gameObject);
    }
コード例 #13
0
 public void ShowNextSection()
 {
     if (levelCount == 1)
     {
         Level1Player.GetComponent <PlayerMovement>().MovementEnabled = false;
         Level1Player.GetComponent <Rigidbody>().isKinematic          = true;
         SwitchSound.Play();
         Level2.SetActive(true);
         Level2Player.GetComponent <PlayerMovement>().MovementEnabled = true;
         levelCount++;
     }
     else if (levelCount == 2)
     {
         Level2Player.GetComponent <PlayerMovement>().MovementEnabled = false;
         SwitchSound.Play();
         Level3.SetActive(true);
         Level3Player.GetComponent <PlayerMovement>().MovementEnabled = true;
         levelCount++;
     }
     else
     {
         BaseCam.SetActive(true);
         BackgroundMusic.Stop();
         SceneManager.LoadScene("ZiedNextLevel", LoadSceneMode.Single);
     }
 }
コード例 #14
0
    public static SceneObject Create(SceneState _scene)
    {
        SceneObject scene = null;

        switch (_scene)
        {
        case SceneState.StartScreen:
            scene = new StartScreen();
            break;

        case SceneState.Level1:
            scene = new Level1();
            break;

        case SceneState.Level2:
            scene = new Level2();
            break;

        case SceneState.Level3:
            scene = new Level3();
            break;

        case SceneState.Level4:
            scene = new Level4();
            break;

        case SceneState.SummaryScreen:
            scene = new SummaryScreen();
            break;

        default:
            return(null);
        }
        return(scene);
    }
コード例 #15
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
コード例 #16
0
        public void Should_activate_all_upstream_dependencies_when_chain_deep()
        {
            var defaultsOrder = new List <Feature>();

            var level1 = new Level1
            {
                OnDefaults = f => defaultsOrder.Add(f)
            };
            var level2 = new Level2
            {
                OnDefaults = f => defaultsOrder.Add(f)
            };
            var level3 = new Level3
            {
                OnDefaults = f => defaultsOrder.Add(f)
            };

            //the orders matter here to expose a bug
            featureSettings.Add(level3);
            featureSettings.Add(level2);
            featureSettings.Add(level1);

            featureSettings.SetupFeatures(null, null);

            Assert.True(level1.IsActive, "Level1 wasn't activated");
            Assert.True(level2.IsActive, "Level2 wasn't activated");
            Assert.True(level3.IsActive, "Level3 wasn't activated");

            Assert.IsInstanceOf <Level1>(defaultsOrder[0], "Upstream dependencies should be activated first");
            Assert.IsInstanceOf <Level2>(defaultsOrder[1], "Upstream dependencies should be activated first");
            Assert.IsInstanceOf <Level3>(defaultsOrder[2], "Upstream dependencies should be activated first");
        }
コード例 #17
0
        private void OpenWindow(object obj)
        {
            dynamic item;

            if (SelectedOrder != null)
            {
                item = SelectedOrder;
            }
            else
            {
                item = SelectedStoporder;
            }
            switch (obj.ToString())
            {
            case "level2":
            {
                var view = new Level2();
                view.DataContext = new Level2ViewModel(item.Board, item.Seccode, view);
                view.Show();
                break;
            }

            case "alltrades":
            {
                var view = new AllTrades();
                view.DataContext = new AllTradesViewModel(item.Board, item.Seccode, view);
                view.Show();
                break;
            }

            case "chart":
            {
                var view = new SciChartWindow();
                view.DataContext = new SciChartViewModel(item.Board, item.Seccode, view);
                view.Show();
                break;
            }

            case "orders":
                if (MainWindowViewModel.CheckIfWindowIsOpened(typeof(ClientOrders)))
                {
                    break;
                }
                new ClientOrders {
                    DataContext = MainWindowViewModel.ClientOrdersViewModel
                }.Show();
                break;

            case "stoporders":
                if (MainWindowViewModel.CheckIfWindowIsOpened(typeof(ClientStoporders)))
                {
                    break;
                }
                new ClientStoporders {
                    DataContext = MainWindowViewModel.ClientOrdersViewModel
                }.Show();
                break;
            }
        }
コード例 #18
0
    void Awake()
    {
        //       mover = Distancefromp.GetComponent<mover>();
        Level2 = subjectnum.GetComponent <Level2>();
        // Variables = Part2.GetComponent<Variables>();//mover = movers.GetComponent<mover>();

        // Arm = ArmLength;
    }
        /// <summary>
        /// Build Level2 object from Category data.
        /// </summary>
        /// <param name="category">Category data to use.</param>
        /// <returns>Populated Level2 object.</returns>
        private static Level2 BuildLevel2(Category category)
        {
            Level2 level2 = new Level2();

            level2.LDCS         = BuildLdcsInfoType(category);
            level2.CourseCounts = category.CourseCount.ToString();

            return(level2);
        }
        /// <summary>
        /// Build SubjectBrowseOutput object from collection of Categories.
        /// </summary>
        /// <remarks>
        /// The FetchCategories stored procedure returns Category results in a specific order, e.g.
        /// Level 1:    .A - Art
        /// Level 2:        .A.1 - Animation / Multimedia Software
        /// Level 3:            CC.31 - Animation Software (Use)
        /// Level 3:            CC.3111 - 3d Studio (Animation Software)
        /// Level 3:            CC.3122 - Flash (Animation Software)
        /// Level 2:        .A.10 - Graphics Software
        /// Level 3:            CC.34 - Drawing / Painting Software (Use)
        /// Level 3:            CC.34 - Graphics Software (Use)
        /// Level 1:    .ACE - Adult and Continuing Education
        /// Level 2:        .ACE.2 - Job Preparation
        /// Level 3:            HC.1 - Career Planning
        /// ... etc.
        /// This code expects the results to be in this sequence.
        /// </remarks>
        /// <param name="categories">Categories collection.</param>
        /// <returns>Populated SubjectBrowseOutput object.</returns>
        private static SubjectBrowseOutput BuildSubjectBrowseOutput(List <Category> categories)
        {
            SubjectBrowseOutput subjectBrowseOutput = new SubjectBrowseOutput();
            List <Level1>       level1s             = new List <Level1>();
            List <Level2>       level2s             = new List <Level2>();
            List <CategoryInfo> level3s             = new List <CategoryInfo>();

            Level1       currentLevel1 = null;
            Level2       currentLevel2 = null;
            CategoryInfo currentLevel3;

            foreach (Category category in categories)
            {
                switch (category.Level)
                {
                case 1:
                    currentLevel1 = BuildLevel1(category);
                    level1s.Add(currentLevel1);

                    // clear the level 2's so we don't have the
                    // previous level 1 level 2's in there
                    level2s.Clear();
                    break;

                case 2:
                    currentLevel2 = BuildLevel2(category);
                    if (currentLevel1.Level2 != null)
                    {
                        level2s = currentLevel1.Level2.ToList();
                    }
                    level2s.Add(currentLevel2);
                    currentLevel1.Level2 = level2s.ToArray();

                    // clear the level 3's so we don't have the
                    // previous level 2 level 3's in there
                    level3s.Clear();
                    break;

                case 3:
                    currentLevel3 = BuildCategoryInfo(category);
                    if (currentLevel2.Level3 != null)
                    {
                        level3s = currentLevel2.Level3.ToList();
                    }
                    level3s.Add(currentLevel3);
                    currentLevel2.Level3 = level3s.ToArray();
                    break;

                default:
                    break;
                }
            }

            subjectBrowseOutput.Level1 = level1s.ToArray();

            return(subjectBrowseOutput);
        }
コード例 #21
0
        public override void Next()
        {
            Hide();
            Level2 level2 = new Level2(GetScore(), GetLives(), SplashHold);

            level2.Closed += (s, args) => SplashHold.Close();
            level2.Show();
            Dispose();
        }
コード例 #22
0
        protected override void OnUpdate(SingleAdviser <int> adviser)
        {
            string symbol = "EUR/USD";
            Level2 first  = m_first.GetLevel2(symbol);
            Order  sell   = new Order(m_first, symbol, first.Bid, cVolume, OrderType.Market, TradeSide.Sell);

            sell.Run();
            sell.Join();
        }
コード例 #23
0
ファイル: Index.cs プロジェクト: deezus-net/Molder
 public bool Equals(Spatial target)
 {
     return(TessellationSchema?.ToLower() == target.TessellationSchema?.ToLower() &&
            Level1?.ToLower() == target.Level1?.ToLower() &&
            Level2?.ToLower() == target.Level2?.ToLower() &&
            Level3?.ToLower() == target.Level3?.ToLower() &&
            Level4?.ToLower() == target.Level4?.ToLower() &&
            CellsPerObject == target.CellsPerObject);
 }
コード例 #24
0
ファイル: Transaction.cs プロジェクト: ifzz/FDK
		internal void AddPrices(Level2 first, Level2 second)
		{
            if (first.Asks.Count == 0 || second.Bids.Count == 0)
            {
                m_builder.AppendLine("No quotes for level2");
                return;
            }
			int spread = PipsFromPrice(first.Ask - second.Bid);
			m_builder.AppendFormat("{0}> [{1}].Ask = {2}; [{3}].Bid = {4}; spread = {5} pip(s)", UtcNow(), m_first, first.Ask, m_second, second.Bid, spread);
			m_builder.AppendLine();
		}
コード例 #25
0
ファイル: PositionDataLeft.cs プロジェクト: x16755/Final
    // Use this for initialization
    void Start()
    {
        Order     = GameObject.FindGameObjectWithTag("UI").GetComponent <Order>();
        Level2    = GameObject.FindGameObjectWithTag("Player").GetComponent <Level2>();
        Variables = GameObject.FindGameObjectWithTag("UI").GetComponent <Variables>();

        StreamWriter sw = File.AppendText(Variables.folder + "PositionDataLeft" + Variables.participant + ".csv");

        sw.WriteLine("RotationX" + "," + "RotationY" + "," + "RotationZ" + "," + "PositionX" + "," + "PositionY" + "," + "PositionZ" + "," + "Button Pressed" + "," + "Frame" + "," + "TimeFromStart" + "," + "TimeInTrial" + "," + "Block" + "," + "Trial" + "," + "Scene" + "," + "Condition" + "," + "IsTrial" + "," + "IsWait");
        sw.Close();
    }
コード例 #26
0
    // Update is called once per frame
    void Update()
    {
        Variables = GameObject.FindGameObjectWithTag("UI").GetComponent <Variables>();
        Level2    = GameObject.FindGameObjectWithTag("Player").GetComponent <Level2>();

        if (Level2.Block == 2)
        {
            if (Variables.order == 0)
            {
                Condition = 1;
            }
            if (Variables.order == 1)
            {
                Condition = 2;
            }
        }

        /*    if (Variables.order == 2)
         *  {
         *      Condition = 3;
         *  }
         * }
         * if (Level2.Block == 3)
         * {
         *  if (Variables.order == 0)
         *  {
         *      Condition = 2;
         *  }
         *  if (Variables.order == 1)
         *  {
         *      Condition = 3;
         *  }
         *  if (Variables.order == 2)
         *  {
         *      Condition = 1;
         *  }
         * }
         * if (Level2.Block == 4)
         * {
         *  if (Variables.order == 0)
         *  {
         *      Condition = 3;
         *  }
         *  if (Variables.order == 1)
         *  {
         *      Condition = 1;
         *  }
         *  if (Variables.order == 2)
         *  {
         *      Condition = 2;
         *  }
         * }*/
    }
コード例 #27
0
        public void Ce_Insert_LowLevel()
        {
            long ms = 0;

            using (new MetricTracker("Starting complex object", t => ms = t))
            {
                Level1 level1 = new Level1();
                level1.Value  = "test";
                level1.levels = new List <Level2>();

                for (int i = 0; i < 5; i++)
                {
                    Level2 curLevel2 = new Level2();
                    level1.levels.Add(curLevel2);
                    curLevel2.Value  = "test" + i.ToString();
                    curLevel2.levels = new List <Level3>();

                    for (int j = 0; j < 5; j++)
                    {
                        Level3 curLevel3 = new Level3();
                        curLevel2.levels.Add(curLevel3);
                        curLevel3.Value  = "test" + j.ToString();
                        curLevel3.levels = new List <Level4>();

                        for (int k = 0; k < 10; k++)
                        {
                            Level4 curLevel4 = new Level4();
                            curLevel3.levels.Add(curLevel4);
                            curLevel4.Value  = "test" + k.ToString();
                            curLevel4.levels = new List <Level5>();

                            for (int l = 0; l < 10; l++)
                            {
                                Level5 curLevel5 = new Level5();
                                curLevel4.levels.Add(curLevel5);
                                curLevel5.Value = "test" + l.ToString();
                            }
                        }
                    }
                }

                SqlCeConnectionFactory cf = new SqlCeConnectionFactory("System.Data.SqlServerCE.4.0");
                using (SqlCeConnection conn = (SqlCeConnection)cf.CreateConnection(@"c:\temp\myDataPoor.sdf"))
                {
                    conn.Open();

                    // Level1
                    int parentId = SqlCeInsertAdapterLevels.Write_Level1(level1, conn);
                }
            }

            ms.Should().BeLessThan(775);
        }
コード例 #28
0
        internal void AddPrices(Level2 first, Level2 second)
        {
            if (first.Asks.Count == 0 || second.Bids.Count == 0)
            {
                m_builder.AppendLine("No quotes for level2");
                return;
            }
            int spread = PipsFromPrice(first.Ask - second.Bid);

            m_builder.AppendFormat("{0}> [{1}].Ask = {2}; [{3}].Bid = {4}; spread = {5} pip(s)", UtcNow(), m_first, first.Ask, m_second, second.Bid, spread);
            m_builder.AppendLine();
        }
コード例 #29
0
ファイル: BankSaver.cs プロジェクト: ifzz/FDK
 public void AddQuote(Level2 level2)
 {
     Queue<Level2> queueLevel2;
     lock(obj)
     {
         if (!dictSymbolLevel2.TryGetValue(level2.Symbol, out queueLevel2))
         {
             queueLevel2 = new Queue<Level2>(100000);
             dictSymbolLevel2.Add(level2.Symbol, queueLevel2);
         }
         queueLevel2.Enqueue(level2);
     }
 }
コード例 #30
0
ファイル: BankSaver.cs プロジェクト: hombrevrc/FDK
        public void AddQuote(Level2 level2)
        {
            Queue <Level2> queueLevel2;

            lock (obj)
            {
                if (!dictSymbolLevel2.TryGetValue(level2.Symbol, out queueLevel2))
                {
                    queueLevel2 = new Queue <Level2>(100000);
                    dictSymbolLevel2.Add(level2.Symbol, queueLevel2);
                }
                queueLevel2.Enqueue(level2);
            }
        }
コード例 #31
0
    //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    //                                                                                                                        CreateLevel2()
    //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    public void CreateLevel2()
    {
        _level2 = new Level2();
        AddChild(_level2);

        CreateHUD();
        CreatePauseMenu();

        Globals.playerIsDead    = false;
        Globals.showMouseCursor = false;

        level1IsActive            = false;
        level2IsActive            = true;
        Globals.levelBossIsActive = false;
    }
コード例 #32
0
        /// <summary>
        /// The constructor for the GameplayScreen
        /// </summary>
        public GameplayScreen(Game game)
        {
            TransitionOnTime  = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            _pauseAction = new InputAction(
                new[] { Buttons.Start, Buttons.Back },
                new[] { Keys.Back, Keys.Escape }, true);

            _game = game;

            level0 = new Level0(_game);//ScreenManager.Game);
            level1 = new Level1();
            level2 = new Level2();
        }
コード例 #33
0
ファイル: NamingHelper.cs プロジェクト: McoreD/PCDMS
        public NamingHelper()
        {
            if (File.Exists(_filePath))
            {
                _codes = File.ReadAllLines(_filePath).Skip(1).Select(v => NamingData.FromCsv(v)).ToList();
            }

            if (_codes.Count > 0)
            {
                Level1.AddRange(_codes.Where(x => x.Level == 1).ToList());
                Level2.AddRange(_codes.Where(x => x.Level == 2).ToList());
                Level3.AddRange(_codes.Where(x => x.Level == 3).ToList());
                Level4.AddRange(_codes.Where(x => x.Level == 4).ToList());
                Level5.AddRange(_codes.Where(x => x.Level == 5).ToList());
            }
        }
コード例 #34
0
        public void ReturnCorrectObject()
        {

            var scope = new ProcessingScope();
            var o1 = new Level1();
            var o2 = new Level1();
            var o2_1 = new Level2();

            scope.Set(o1);
            Assert.AreSame(o1, scope.Current<Level1>());

            scope.Set(o2);
            Assert.AreSame(o2, scope.Current<Level1>());

            var childScope = scope.CreateChildScope(new DummyMapper()).Set(o2_1);
            Assert.AreSame(o2_1, childScope.Current<Level2>());
            Assert.AreSame(o2, childScope.Current<Level1>());
        }
コード例 #35
0
ファイル: Manager.cs プロジェクト: remberluyckx/mygame
 public Manager()
 {
     mVideo = Video.SetVideoMode(794, 494);           
     Console.Title = "Alien Terrorist Killer";
     hero = new Hero(mVideo, SdlDotNet.Input.Key.A, SdlDotNet.Input.Key.D, SdlDotNet.Input.Key.Space, SdlDotNet.Input.MouseButton.PrimaryButton); // QWERTY dus A = Q           
     enemy_1 = new Point(10, 305);
     enemy_2 = new Point(570, 305);
     enemy_3 = new Point(340, 185);
     enemy_4 = new Point(650, 65);
     heartContainerPoint = new Point(725, 185);
     heartPoint = new Point(20, 20);
     heartPoint2 = new Point(70, 20);
     heartPoint3 = new Point(120, 20);
     vijand1 = new Vijand(mVideo, enemy_1, 100, 290);
     vijand2 = new Vijand(mVideo, enemy_2, 570, 680);
     vijand3 = new Vijand(mVideo, enemy_3, 340, 570);
     vijand4 = new Vijand(mVideo, enemy_4, 650, 700);
     groundColRectangle = new Rectangle(0, 480, 794, 24); //486 = 510(17*30) - 24(Ground height) --- 794 (Ground width) 24 (Ground height)
     platform1_ColRectangle = new Rectangle(0, 360, 350, 15); 
     platform2_ColRectangle = new Rectangle(570, 360, 350, 15);
     platform3_ColRectangle = new Rectangle(300, 240, 350, 15); // x = 10, y = 8 --> 10  *30 = 300 /// 8 * 30 = 240  /// x en y vanaf 0 tellen in array! 
     platform4_ColRectangle = new Rectangle(660, 120, 350, 15);
     spikes1_ColRectangle = new Rectangle(420, 420, 85, 71);
     lasers = new Lasers();
     slimes = new Slimes();
     level1 = new Level1(mVideo);
     level2 = new Level2(mVideo);
     startscreen = new Startscreen(mVideo);
     endscreen = new Endscreen(mVideo);
     activelevel = startscreen;
     immuneTimer = 0;
     drawTimer = 0;
     shootTimer = 0;
     audioThread.Start();
     sndLaser.Volume = sndPain.Volume = 15;           
              
     Events.Tick += Events_Tick;
     Events.Run();
 }
コード例 #36
0
 private void StartState()
 {
     switch (_state)
     {
         case "MainMenu":
             _menu = new MainMenu(this);
             AddChild(_menu);
             break;
         case "HighScores":
             _scores = new HighScores(this);
             AddChild(_scores);
             break;
         case "Credits":
             _credits = new Credits(this);
             AddChild(_credits);
             break;
         case "Level1":
             _level1 = new Level1(this);
             AddChild(_level1);
             break;
         case "Level2":
             _level2 = new Level2(this, 5); //Would have _lives instead of 5 if pickups were implemented
             AddChild(_level2);
             break;
         case "Level3":
             _level3 = new Level3(this, 5); //Idem ditto
             AddChild(_level3);
             break;
         case "WonGame":
             _wonGame = new WonGame(this);
             AddChild(_wonGame);
             break;
         case "Exit":
             Environment.Exit(0);
             break;
         default:
             throw new Exception("You tried to load a non-existant state");
     }
 }
コード例 #37
0
ファイル: WatcherSymbol.cs プロジェクト: ifzz/FDK
		private void Run(SingleAdviser<int> first, SingleAdviser<int> second, Level2 f, Level2 s, ref  Arbitrage arb)
		{
			if ( f.Bids.Count == 0 || s.Asks.Count == 0 || s.Ask - f.Bid > -float.Epsilon)
			{
                if (null != arb)
				{
                    arb.EndDateTime = DateTime.UtcNow;
                    arb.Duration = (arb.EndDateTime - arb.StartDateTime).TotalMilliseconds;
                    ArbitrageDetail prevArbDetail = arb.ArbitrageDetails.Last();
                    prevArbDetail.EndTickTime = arb.EndDateTime;
                    prevArbDetail.duration = (prevArbDetail.EndTickTime - prevArbDetail.StartTickTime).TotalMilliseconds;

                    double test = Math.Abs(arb.ArbitrageDetails.Sum(p => p.duration));
                    if (test - arb.Duration > 0.0000000001)
                    {
                        Console.WriteLine("DurationError");
                    }

                    Arbitrage refArbitrage = arb;
                    //Task.Factory.StartNew(() =>
                    //{
                    //    using (Model.ArbitrageContext arbContext = new Model.ArbitrageContext())
                    //    {
                    //        arbContext.Arbitrages.Add(refArbitrage);
                    //        arbContext.SaveChanges();
                    //    }
                    //});

                    arb = null;

                    if (!dictSPairs.Any(p => p.Value.m_firstBidSecondAskArbitrage != null))
                    {
                        ArbitrageTimeStatistics ars = ArbitrageTimeStatistics.Instance(f.Symbol);
                        ars.TotalSecondsArbitradge += (DateTime.UtcNow - ars.StartArbitrageDateTime).TotalSeconds;
                        ars.StartArbitrageDateTime = DateTime.MinValue;

                        Console.WriteLine("Symbol={3}; ArbitrageTime={0} seconds; Percent={1}%; InHourSeconds={2}", ars.TotalSecondsArbitradge,
                            ars.TotalSecondsArbitradge * 100 / (DateTime.UtcNow - ArbitrageTimeStatistics.StartAppDateTime).TotalSeconds,
                            ars.TotalSecondsArbitradge * 3600 / (DateTime.UtcNow - ArbitrageTimeStatistics.StartAppDateTime).TotalSeconds,
                            f.Symbol);
                    }
				
                }
			}
			else
			{
                DateTime utcNow = DateTime.UtcNow;

                if (arb == null)
                    arb = new Arbitrage(utcNow, first.Tag, second.Tag, m_symbol);

                ArbitrageDetail arbDetail = new ArbitrageDetail(utcNow);
                if (f.Asks.Count > 0)
                {
                    arbDetail.B1Ask1 = f.Asks[0].Price;
                    arbDetail.B1Ask1Volume = f.Asks[0].Volume;
                }
                arbDetail.B1Bid1 = f.Bids[0].Price;
                arbDetail.B1Bid1Volume = f.Bids[0].Volume;
                arbDetail.B2Ask1 = s.Asks[0].Price;
                arbDetail.B2Ask1Volume = s.Asks[0].Volume;
                if (s.Bids.Count > 0)
                {
                    arbDetail.B2Bid1 = s.Bids[0].Price;
                    arbDetail.B2Bid1Volume = s.Bids[0].Volume;
                }
                if (arb.ArbitrageDetails.Count != 0)
                {
                    ArbitrageDetail previos = arb.ArbitrageDetails.Last();
                    previos.EndTickTime = arbDetail.StartTickTime;
                    previos.duration = (previos.EndTickTime - previos.StartTickTime).TotalMilliseconds;
                }
                arbDetail.spread = s.Ask - f.Bid;
                arb.ArbitrageDetails.Add(arbDetail);

                if (ArbitrageTimeStatistics.Instance(f.Symbol).StartArbitrageDateTime == DateTime.MinValue)
                    ArbitrageTimeStatistics.Instance(f.Symbol).StartArbitrageDateTime = DateTime.UtcNow;

                //CheckDoubleArbitrage(first.Tag, second.Tag);
			}
		}
コード例 #38
0
        public void Should_activate_all_upstream_deps_when_chain_deep()
        {
            var order = new List<Feature>();

           
            var level1 = new Level1
            {
                OnActivation = f => order.Add(f)
            };
            var level2 = new Level2
            {
                OnActivation = f => order.Add(f)
            };
            var level3 = new Level3
            {
                OnActivation = f => order.Add(f)
            };

            var settings = new SettingsHolder();
            var featureSettings = new FeatureActivator(settings);

            //the orders matter here to expose a bug
            featureSettings.Add(level3);
            featureSettings.Add(level2);
            featureSettings.Add(level1);

            featureSettings.SetupFeatures(new FeatureConfigurationContext(null));


            Assert.True(level1.IsActive, "Level1 wasn't activated");
            Assert.True(level2.IsActive, "Level2 wasn't activated");
            Assert.True(level3.IsActive, "Level3 wasn't activated");

            Assert.IsInstanceOf<Level1>(order[0], "Upstream deps should be activated first");
            Assert.IsInstanceOf<Level2>(order[1], "Upstream deps should be activated first");
            Assert.IsInstanceOf<Level3>(order[2], "Upstream deps should be activated first");
        }
コード例 #39
0
ファイル: JewSaver.cs プロジェクト: JuzzWuzz/TheSaver
 public void SwitchState(GameState gameState)
 {
     switch (gameState)
     {
         case GameState.LEVEL_1:
             this.Components.Remove(mainMenu);
             level3 = new Level3(this);
             Components.Add(level3);
             currentLevel = level3;
             break;
         case GameState.MAIN_MENU:
             this.Components.Remove(currentLevel);
             mainMenu = new MenuJewSaver(this);
             Components.Add(mainMenu);
             break;
         case GameState.LEVEL_2:
             this.Components.Remove(level1);
             level2 = new Level2(this);
             this.Components.Add(level2);
             currentLevel = level2;
             break;
         case GameState.LEVEL_3:
             this.Components.Remove(level2);
             level3 = new Level3(this);
             this.Components.Add(level3);
             currentLevel = level3;
             break;
         default:
             break;
     }
 }
コード例 #40
0
        public void TestNesting()
        {
            var scope1 = new ProcessingScope();
            var scope2 = scope1.CreateChildScope(new DummyMapper());
            var scope3 = scope2.CreateChildScope(new DummyMapper());

            var o1 = new Level1();
            var o1_1 = new Level2();
            var o1_1_1 = new Level3();
            var o1_1_2 = new Level3();
            var o1_2 = new Level2();
            var o2 = new Level1();
            var o2_1 = new Level2();
            var o3 = new Level1();
            var o3_1 = new Level2();
            var o3_2 = new Level2();
            var o3_2_1 = new Level3();
            var o3_3 = new Level2();
            var o3_3_1 = new Level3();
            var o3_3_2 = new Level3();

            scope1.Set(o1);
            Assert.AreEqual(1, scope1.GlobalIndex);
            scope2.Set(o1_1);
            Assert.AreEqual(1, scope2.Index<Level1>());
            Assert.AreEqual(1, scope2.Index<Level2>());

            scope3.Set(o1_1_1);
            Assert.AreEqual(1, scope3.Index<Level1>());
            Assert.AreEqual(1, scope3.Index<Level2>());
            Assert.AreEqual(1, scope3.Index<Level3>());
            scope3.Set(o1_1_2);
            Assert.AreEqual(2, scope3.Index<Level1>());
            Assert.AreEqual(2, scope3.Index<Level2>());
            Assert.AreEqual(2, scope3.Index<Level3>());
            Assert.AreEqual(2, scope3.ChildIndex);
            Assert.AreEqual(2, scope3.GlobalIndex);

            scope2.Set(o1_2);
            Assert.AreEqual(2, scope2.Index<Level1>());
            Assert.AreEqual(2, scope2.Index<Level2>());
            Assert.AreEqual(2, scope2.ChildIndex);
            Assert.AreEqual(2, scope3.GlobalIndex);

            scope1.Set(o2);
            Assert.AreEqual(2, scope1.GlobalIndex);
            scope2 = scope2.Set(o2_1);
            Assert.AreEqual(1, scope2.Index<Level1>());
            Assert.AreEqual(3, scope2.GlobalIndex);

            scope1.Set(o3);
            Assert.AreEqual(3, scope1.GlobalIndex);
            scope2 = scope2.Set(o3_1);
            Assert.AreEqual(1, scope2.Index<Level1>());
            Assert.AreEqual(4, scope2.GlobalIndex);

            scope2.Set(o3_2);
            Assert.AreEqual(2, scope2.Index<Level1>());
            Assert.AreEqual(5, scope2.GlobalIndex);

            scope3.Set(o3_2_1);
            Assert.AreEqual(1, scope3.Index<Level1>());
            Assert.AreEqual(1, scope3.Index<Level2>());
            Assert.AreEqual(3, scope3.GlobalIndex);

            scope2.Set(o3_3);
            Assert.AreEqual(3, scope2.Index<Level1>());
            Assert.AreEqual(6, scope2.GlobalIndex);

            scope3.Set(o3_3_1);
            Assert.AreEqual(2, scope3.Index<Level1>());
            Assert.AreEqual(1, scope3.Index<Level2>());
            Assert.AreEqual(4, scope3.GlobalIndex);

            scope3.Set(o3_3_2);
            Assert.AreEqual(3, scope3.Index<Level1>());
            Assert.AreEqual(2, scope3.Index<Level2>());
            Assert.AreEqual(5, scope3.GlobalIndex);

            //Check that the objects are correctly assigned

            Assert.AreSame(o3, scope3.Current<Level1>());
            Assert.AreSame(o3_3, scope3.Current<Level2>());
            Assert.AreSame(o3_3_2, scope3.Current<Level3>());

            Assert.AreSame(o3, scope2.Current<Level1>());
            Assert.AreSame(o3_3, scope2.Current<Level2>());

            Assert.AreSame(o3, scope1.Current<Level1>());
        }
コード例 #41
0
        public void Should_activate_all_upstream_dependencies_when_chain_deep()
        {
            var defaultsOrder = new List<Feature>();
           
            var level1 = new Level1
            {
                OnDefaults = f => defaultsOrder.Add(f)
            };
            var level2 = new Level2
            {
                OnDefaults = f => defaultsOrder.Add(f)
            };
            var level3 = new Level3
            {
                OnDefaults = f => defaultsOrder.Add(f)
            };

            //the orders matter here to expose a bug
            featureSettings.Add(level3);
            featureSettings.Add(level2);
            featureSettings.Add(level1);

            featureSettings.SetupFeatures(null, null);

            Assert.True(level1.IsActive, "Level1 wasn't activated");
            Assert.True(level2.IsActive, "Level2 wasn't activated");
            Assert.True(level3.IsActive, "Level3 wasn't activated");

            Assert.IsInstanceOf<Level1>(defaultsOrder[0], "Upstream dependencies should be activated first");
            Assert.IsInstanceOf<Level2>(defaultsOrder[1], "Upstream dependencies should be activated first");
            Assert.IsInstanceOf<Level3>(defaultsOrder[2], "Upstream dependencies should be activated first");
        }