public static void Initialize (CCGameView gameView) { GameView = gameView; var contentSearchPaths = new List<string> () { "Fonts", "Sounds" }; #if __IOS__ contentSearchPaths.Add("Sounds/iOS/"); #else // android contentSearchPaths.Add("Sounds/Android/"); #endif contentSearchPaths.Add("Images"); GameView.ContentManager.SearchPaths = contentSearchPaths; // We use a lower-resolution display to get a pixellated appearance int width = 384; int height = 512; GameView.DesignResolution = new CCSizeI (width, height); InitializeAudio(); var scene = new TitleScene (GameView); GameView.Director.RunWithScene (scene); }
public GameScene(CCGameView gameView) : base(gameView) { CreateLayers(); fruitList = new List<Fruit>(); CreateBackground(); CreatePaddle(); CreateBins(); CreateForeground(); CreateTouchListener(); CreateHud(); CreateSpawner(); CreateDebugLabel(); Schedule(Activity); }
public TitleScene(CCGameView gameView) : base(gameView) { layer = new CCLayer(); this.AddChild(layer); CreateText(); CreateTouchListener(); }
public GameScene (CCGameView gameView) : base(gameView) { var layer = new CCLayer (); this.AddLayer (layer); circle = new CCDrawNode (); layer.AddChild (circle); circle.DrawCircle ( // The center to use when drawing the circle, // relative to the CCDrawNode: new CCPoint (0, 0), radius:15, color:CCColor4B.White); circle.PositionX = 20; circle.PositionY = 50; }
public static void LoadGame(object sender, EventArgs e) { GameView = sender as CCGameView; if (GameView != null) { var contentSearchPaths = new List <string>() { "Fonts", "Sounds" }; CCSizeI viewSize = GameView.ViewSize; int width = 1024; int height = 768; // Set world dimensions GameView.DesignResolution = new CCSizeI(width, height); GameView.ResolutionPolicy = CCViewResolutionPolicy.ExactFit; // Determine whether to use the high or low def versions of our images // Make sure the default texel to content size ratio is set correctly // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd) if (width < viewSize.Width) { //contentSearchPaths.Add("Images/Collision"); CCSprite.DefaultTexelToContentSizeRatio = 2.0f; } else { //contentSearchPaths.Add("Images/Periphery"); CCSprite.DefaultTexelToContentSizeRatio = 1.0f; } GameView.ContentManager.SearchPaths = contentSearchPaths; var gameScene = new GameScene(GameView); GameView.RunWithScene(gameScene); } }
void LoadGame(object sender, EventArgs e) { CCGameView gameView = sender as CCGameView; if (gameView != null) { var contentSearchPaths = new List <string>() { "Fonts", "Sounds" }; CCSizeI viewSize = gameView.ViewSize; int width = 1024; int height = 768; // // Set world dimensions gameView.DesignResolution = new CCSizeI(gameView.Width, gameView.Height); gm = new GameLayer(); // gm.mymethod(gameView.Width, gameView.Height); // Determine whether to use the high or low def versions of our images // Make sure the default texel to content size ratio is set correctly // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd) if (width < viewSize.Width) { contentSearchPaths.Add("Images/Hd"); CCSprite.DefaultTexelToContentSizeRatio = 2.0f; } else { contentSearchPaths.Add("Images/Ld"); CCSprite.DefaultTexelToContentSizeRatio = 1.0f; } gameView.ContentManager.SearchPaths = contentSearchPaths; CCScene gameScene = new CCScene(gameView); gameScene.AddLayer(new GameLayer()); gameView.RunWithScene(gameScene); } }
//CONSTRUCTOR public OldPipelineProtocolsScene2(CCGameView gameView) : base(gameView) { stopEverything = false; animationIsPaused = false; //add a layer to draw on layer = new CCLayer(); this.AddLayer(layer); windowSize = OldPipelineProtocols.windowSize; strategy = OldPipelineProtocols.strategy; timeouttime = OldPipelineProtocols.timeoutTime; pendingAck = new List <int>(); arrivedPack = new List <int>(); arrivedPack.Add(-1); //important for knowing which seqnum was the las recent one to be received in order arrivedAck = new List <int>(); //Android bug: Background in Android is always black. Workaround: draw a white rect with the size of the layer if (Device.RuntimePlatform == Device.Android) { var cc_background = new CCDrawNode(); var backgroundWorkAround = new CCRect( 0, 0, layer.VisibleBoundsWorldspace.MaxX, layer.VisibleBoundsWorldspace.MaxY); cc_background.DrawRect(backgroundWorkAround, fillColor: CCColor4B.White); layer.AddChild(cc_background); } DrawLabelsAndBoxes(); baseOfWindowLeft = 0; expectedSeqnum = 0; nextSeqnum = 0; DrawWindow(baseOfWindowLeft); DrawExpectedSeqnum(); }
void LoadGame(object sender, EventArgs e) { CCGameView gameView = sender as CCGameView; if (gameView != null) { var contentSearchPaths = new List <string>() { "Fonts", "Sounds", "Images/Animals" }; CCSizeI viewSize = gameView.ViewSize; int width = 960; int height = 540; // Set world dimensions gameView.DesignResolution = new CCSizeI(width, height); gameView.ResolutionPolicy = CCViewResolutionPolicy.ShowAll; // Determine whether to use the high or low def versions of our images // Make sure the default texel to content size ratio is set correctly // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd) if (width < viewSize.Width) { contentSearchPaths.Add("Images/Hd"); //CCSprite.DefaultTexelToContentSizeRatio = 2.0f; } else { contentSearchPaths.Add("Images/Ld"); CCSprite.DefaultTexelToContentSizeRatio = 1.0f; } gameView.ContentManager.SearchPaths = contentSearchPaths; PlayBackgroundMusic(); // Construct game scene _gameView = gameView; RunMenu(); } }
void LoadGame(object sender, EventArgs e) { CCGameView gameView = sender as CCGameView; if (gameView != null) { var contentSearchPaths = new List <string>() { "fonts", "sounds" }; gameView.DesignResolution = new CCSizeI(1024, 768); gameView.Stats.Enabled = true; gameView.ContentManager.SearchPaths = contentSearchPaths; CCScene gameScene = new CCScene(gameView); gameScene.AddLayer(new TestController()); gameView.RunWithScene(gameScene); } }
public GameScene(CCGameView gameView) : base(gameView) { var layer = new CCLayer(); this.AddLayer(layer); _context = new DatabaseContext(); var rooms = _context.Rooms.ToList(); //System.Diagnostics.Debug.WriteLine("******************************count " + rooms.Count); foreach (var r in rooms) { float ldx = r.LavaXhodnota * 10; float ldy = r.LavaYhodnota * 10; float rhx = r.PravaXhodnota * 10; float rhy = r.PravaYhodnota * 10; square = new CCDrawNode(); layer.AddChild(square); CCPoint[] verts = new CCPoint[] { new CCPoint(ldx, ldy), new CCPoint(rhx, ldy), new CCPoint(rhx, rhy), new CCPoint(ldx, rhy) }; square.DrawPolygon(verts, count: verts.Length, fillColor: CCColor4B.White, borderWidth: 1, borderColor: CCColor4B.Red, closePolygon: true); /*square.PositionX = ldx; * square.PositionY = ldy;*/ } }
//CONSTRUCTOR public OldAllocationStrategiesScene(CCGameView gameView) : base(gameView) { //add a layer to draw on layer = new CCLayer(); this.AddLayer(layer); pos = 0; suc = 0; //the very first request... indexCFLastAllocated = 0; indexSequenceCF = new List <int>(); besValue = 0; besPos = -1; fragmentList = OldAllocationStrategies.fragmentList; strategy = OldAllocationStrategies.strategy; //create an array for all fragments=memoryblocks memoryBlocks = new int[fragmentList.Count, 2]; for (int i = 0; i < memoryBlocks.GetLength(0); i++) // i < size of Array Dimension 0 { memoryBlocks[i, 0] = fragmentList.ElementAt(i); memoryBlocks[i, 1] = 0; } end = memoryBlocks.GetLength(0) - 1; //Android bug: Background in Android is always black. Workaround: draw a white rect with the size of the layer if (Device.RuntimePlatform == Device.Android) { var cc_background = new CCDrawNode(); var backgroundWorkAround = new CCRect( 0, 0, layer.VisibleBoundsWorldspace.MaxX, layer.VisibleBoundsWorldspace.MaxY); cc_background.DrawRect(backgroundWorkAround, fillColor: CCColor4B.White); layer.AddChild(cc_background); } CalculateNeededVariables(); DrawMemory(); }
public static void Initialize(CCGameView gameView) { GameView = gameView; var contentSearchPaths = new List <string> () { "Fonts", "Sounds" }; contentSearchPaths.Add("Images"); GameView.ContentManager.SearchPaths = contentSearchPaths; // We use a lower-resolution display to get a pixellated appearance int width = 384; int height = 512; GameView.DesignResolution = new CCSizeI(width, height); var scene = new TitleScene(GameView); GameView.Director.RunWithScene(scene); }
public static void LoadGame(object sender, EventArgs e) { CCGameView gameView = sender as CCGameView; if (gameView != null) { var contentSearchPaths = new List <string>() { "Fonts", "Sounds" }; CCSizeI viewSize = gameView.ViewSize; // Set world dimensions gameView.DesignResolution = new CCSizeI(viewSize.Width, viewSize.Height); // Determine whether to use the high or low def versions of our images // Make sure the default texel to content size ratio is set correctly // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd) //if (width < viewSize.Width) //{ // contentSearchPaths.Add("Images/Hd"); // CCSprite.DefaultTexelToContentSizeRatio = 2.0f; //} //else //{ contentSearchPaths.Add("Images/Ld"); CCSprite.DefaultTexelToContentSizeRatio = 1.0f; //} gameView.ContentManager.SearchPaths = contentSearchPaths; CCAudioEngine.SharedEngine.PreloadEffect("pop"); CCScene gameScene = new CCScene(gameView); gameScene.AddLayer(new MenuLayer()); gameView.RunWithScene(gameScene); } }
void LoadGame(object sender, EventArgs e) { CCGameView gameView = sender as CCGameView; if (gameView != null) { var contentSearchPaths = new List <string>() { "Fonts", "Sounds" }; CCSizeI viewSize = gameView.ViewSize; Display display = WindowManager.DefaultDisplay; Point Size = new Point(); display.GetSize(Size); int width = Size.X - 1; int height = Size.Y - 1; gameView.DesignResolution = new CCSizeI(width, height); if (width < viewSize.Width) { contentSearchPaths.Add("Images/Hd"); CCSprite.DefaultTexelToContentSizeRatio = 2.0f; } else { contentSearchPaths.Add("Images/Ld"); CCSprite.DefaultTexelToContentSizeRatio = 1.0f; } gameView.ContentManager.SearchPaths = contentSearchPaths; CCScene gameScene = new CCScene(gameView); gameScene.AddLayer(new GameLayer(this, width, height, IntentType, NrTel, GameId)); gameView.RunWithScene(gameScene); } }
/********************************************************************** *********************************************************************/ //sets up the scene void HandleViewCreated(object sender, EventArgs e) { cc_gameView = sender as CCGameView; if (cc_gameView != null) { //############################################################### //choose gamescene for GoBackN or Selective Repeat if (strategy == "Selective Repeat") { gameScene = new OldPipelineProtocolsScene(cc_gameView); // Starts CocosSharp: cc_gameView.RunWithScene(gameScene); } else { gameScene2 = new OldPipelineProtocolsScene2(cc_gameView); //gameScene2.PositionY = -1100; //reagiert nicht mehr auf touch // Starts CocosSharp: cc_gameView.RunWithScene(gameScene2); } } }
protected override void OnDisappearing() { base.OnDisappearing(); if (scene != null) { scene.RemoveAllChildren(true); scene.RemoveAllListeners(); scene.Dispose(); scene = null; } if (gv != null) { gv.ViewCreated -= HandleViewCreated; // MemoryLeak1対応コード //gv.Dispose(); // RunWithSceneを使う場合、このコードを実行すると落ちることがある gv = null; } if (Content != null) { Content = null; } }
void LoadGame(object sender, EventArgs e) { CCGameView gameView = sender as CCGameView; if (gameView != null) { var contentSearchPaths = new List <string>() { "Fonts", "Sounds", "Images" }; int width = 512; int height = 384; // Set world dimensions gameView.DesignResolution = new CCSizeI(width, height); gameView.ContentManager.SearchPaths = contentSearchPaths; CCScene gameScene = new CCScene(gameView); gameScene.AddLayer(new GameLayer()); gameView.RunWithScene(gameScene); } }
public void ConstructGameScene(CCGameView nativeGameView) { gameScene = new CCScene(nativeGameView); string json = GetBoards("IconBoard"); IconStorageObject jsonObject = null; if (json != "") { try { jsonObject = JsonConvert.DeserializeObject <IconStorageObject>(json); } catch { jsonObject = null; } } mLayer = new GameLayer(width, height, jsonObject, this); gameScene.AddLayer(mLayer); }
public GameScene(CCGameView gameView) : base(gameView) { CreateLayers(); fruitList = new List <Fruit>(); CreateBackground(); CreatePaddle(); CreateBins(); CreateForeground(); CreateTouchListener(); CreateHud(); CreateSpawner(); CreateDebugLabel(); Schedule(Activity); }
public static CCScene GameStartLayerScene(CCGameView mainWindow, float _dynamicWidth, float _dynamicHeight, string json, GamePage gamePage) { var scene = new CCScene(mainWindow); IconStorageObject jsonObject = null; if (json != "") { try { jsonObject = JsonConvert.DeserializeObject <IconStorageObject>(json); } catch { jsonObject = null; } } var layer = new GameLayer(_dynamicWidth, _dynamicHeight, jsonObject, gamePage); scene.AddLayer(layer); return(scene); }
public GameScene(CCGameView gameview) : base(gameview) { Init(); }
public ParticlesScene(CCGameView gameView) : base(gameView) { _layer = new CCLayer(); this.AddLayer(_layer); }
public static CCScene GameScene(CCGameView mainWindow) { var scene = new CCScene(mainWindow); var layer = new GameLayer(); scene.AddChild(layer); return scene; }
//Carry user over to next level private static void getNewMap(CCGameView gameView, character user, int level) { CCScene gamePlayScene = new CCScene(gameView); gamePlayScene.AddLayer(new GameLayer(user, level)); gameView.Director.ReplaceScene(gamePlayScene); }
//Adds a random tilemap - call this to load a new level public static void getNewMap(CCGameView gameView) { CCScene gamePlayScene = new CCScene(gameView); gamePlayScene.AddLayer(new GameLayer()); gameView.Director.ReplaceScene(gamePlayScene); }
public GameScene(CCGameView gameView) : base(gameView) { this.AddLayer(new GameLayer()); }
public GameScene(CCGameView gv) : base(gv) { // 調査用なので何も処理を書いていない }
public HeatMapScene(CCGameView gameView, float index, int max) : base(gameView) { var layer = new CCLayer(); this.AddLayer(layer); _context = new DatabaseContext(); var rooms = _context.Rooms.ToList(); //System.Diagnostics.Debug.WriteLine("******************************count " + rooms.Count); foreach (var r in rooms) { float ldx = r.LavaXhodnota * 10; float ldy = r.LavaYhodnota * 10; float rhx = r.PravaXhodnota * 10; float rhy = r.PravaYhodnota * 10; square = new CCDrawNode(); layer.AddChild(square); CCPoint[] verts = new CCPoint[] { new CCPoint(ldx, ldy), new CCPoint(rhx, ldy), new CCPoint(rhx, rhy), new CCPoint(ldx, rhy) }; square.DrawPolygon(verts, count: verts.Length, fillColor: CCColor4B.White, borderWidth: 1, borderColor: CCColor4B.Red, closePolygon: true); /*square.PositionX = ldx; * square.PositionY = ldy;*/ } if (index > max - 10) { index = max - 10; } var sekv = _context.MovementSekv.Where(t => t.PohSekvId >= index).ToList(); int poc = 1; List <int> vyskyt = new List <int>(); foreach (var s in sekv) { if (poc > 10) { break; } //System.Diagnostics.Debug.WriteLine("POCET +++++ " + s.Cas_Zotrvania); int n = 0; Int32.TryParse(s.Cas_Zotrvania, out n); vyskyt.Add(n); poc++; } int maxVal = vyskyt.Max(); int divide = maxVal / 4; poc = 1; foreach (var s in sekv) { if (poc > 10) { break; } circle = new CCDrawNode(); layer.AddChild(circle); /*circle.DrawCircle( * new CCPoint(0, 0), * radius: 2, * color: CCColor4B.Blue); * circle.PositionX = s.Xhodnota; * circle.PositionY = s.Yhodnota;*/ int n = 0; Int32.TryParse(s.Cas_Zotrvania, out n); if (n >= 0 && n <= divide) { circle.DrawSolidCircle( pos: new CCPoint(s.Xhodnota, s.Yhodnota), radius: 2, color: CCColor4B.Green); } else if (n > divide && n <= divide * 2) { circle.DrawSolidCircle( pos: new CCPoint(s.Xhodnota, s.Yhodnota), radius: 4, color: CCColor4B.Yellow); } else if (n > divide * 2 && n <= divide * 3) { circle.DrawSolidCircle( pos: new CCPoint(s.Xhodnota, s.Yhodnota), radius: 6, color: CCColor4B.Orange); } else { circle.DrawSolidCircle( pos: new CCPoint(s.Xhodnota, s.Yhodnota), radius: 8, color: CCColor4B.Red); } var text = new CCLabel(s.Cas_Zotrvania, "Arial", 10) { Position = new CCPoint(s.Xhodnota, s.Yhodnota), Color = CCColor3B.Black, IsAntialiased = true }; layer.AddChild(text); poc++; } }
public GameScene(CCGameView gameView) : base(gameView) { layer = new GameLayer(CCColor4B.White); AddLayer(layer); }