コード例 #1
0
ファイル: GameImage.cs プロジェクト: dnaismyth/Learning-App
    //Contain method to check whether or not the current letter being caught exists as a letter in the current image
    public bool Contains(GameImage [] g, string l)
    {
        bool b = false;
        for(int i = 0; i < g.Length; i++)
        {
            if (g[i].getLetter().Equals(l) && g[i].getCheck() == false) // check if the letter is equal, and that the bool is set to false (it hasn't yet been printed)
                b = true;

        }
        return b;
    }
コード例 #2
0
ファイル: GameImage.cs プロジェクト: dnaismyth/Learning-App
    //Method to check if the spelling of the word is in the correct order
    public bool correctOrder(GameImage[] g, string l)
    {
        bool b = false;
        for (int i = 0; i < g.Length; i++) {
            if (i != 0) // if we are not searching the first index, i-1 will still exist
            {
                if (g[i].getLetter().Equals(l) && g[i].getCheck() == false && g[i - 1].getCheck() == true) // check if the previous letter has already been caught, if so return true
                {
                    b = true;
                }
            }
            else // otherwise, we are catching the first index
                if (g[i].getLetter().Equals(l) && g[i].getCheck() == false)
            {
                b = true;
            }
        }

        return b;
    }
コード例 #3
0
ファイル: GameImage.cs プロジェクト: dnaismyth/Learning-App
    // Call this method in Update in the CatchController class to determine whether or not the user has collected all of the letters required to make the word
    // If returned true, randomize a new image to be displayed
    public bool checkWinning(GameImage [] g)
    {
        int count = 0; // keep a counter to increment the amount of "caught" letters, and check if it is equal to the array length
        for(int i = 0; i < g.Length; i++)
        {
            if(g[i].getCheck() == true) // check each bool in the GameImage objects to see if it has been caught
            {
                count++;
                if (count == g.Length)
                {
                    win = true; // if the count is equal to the amount of letters in the word, the user has won
                    Debug.Log("You Win");
                }
                else
                    win = false;
            }
        }

        return win;
    }
コード例 #4
0
 protected override void OnInit()
 {
     base.OnInit();
     this.m_togImg = Make <GameImage>(gameObject);
     this.m_alpha  = GetComponents <TweenAlpha>();
 }
コード例 #5
0
		public static bool LoadAnimations()
		{
			if (GameGraphics == null) GameGraphics = new GameImage(512, 346, 4000);

			StringBuilder sb = new StringBuilder();
			sbyte[] abyte0 = null;
			sbyte[] abyte1 = null;
			abyte0 = UnpackData("entity.jag", "people and monsters", 30);
			if (abyte0 == null)
			{
				return false;
			}
			abyte1 = DataOperations.loadData("index.dat", 0, abyte0);
			sbyte[] abyte2 = null;
			sbyte[] abyte3 = null;
			abyte2 = UnpackData("entity.mem", "member graphics", 45);
			if (abyte2 == null)
			{
				return false;
			}
			abyte3 = DataOperations.loadData("index.dat", 0, abyte2);
			int l = 0;
			var animationNumber = 0;
			//label0:
			for (int i1 = 0; i1 < Data.animationCount; i1++)
			{
				//   label4:
				bool breakThis = false;
				String s1 = Data.animationName[i1];
				for (int j1 = 0; j1 < i1; j1++)
				{
					if (!Data.animationName[j1].ToLower().Equals(s1))
						continue;
					Data.animationNumber[i1] = Data.animationNumber[j1];

					// i1++;
					// goto label0;
					//break;
					breakThis = true;
					break;

				}
				if (breakThis) continue;

				//label4:
				sbyte[] abyte7 = DataOperations.loadData(s1 + ".dat", 0, abyte0);
				sbyte[] abyte4 = abyte1;
				if (abyte7 == null)
				{
					abyte7 = DataOperations.loadData(s1 + ".dat", 0, abyte2);
					abyte4 = abyte3;
				}
				if (abyte7 != null)
				{
					try
					{
						GameGraphics.unpackImageData(animationNumber, abyte7, abyte4, 15);
						l += 15;
						if (Data.animationHasA[i1] == 1)
						{
							sbyte[] abyte8 = DataOperations.loadData(s1 + "a.dat", 0, abyte0);
							sbyte[] abyte5 = abyte1;
							if (abyte8 == null)
							{
								abyte8 = DataOperations.loadData(s1 + "a.dat", 0, abyte2);
								abyte5 = abyte3;
							}
							GameGraphics.unpackImageData(animationNumber + 15, abyte8, abyte5, 3);
							l += 3;
						}
						if (Data.animationHasF[i1] == 1)
						{
							sbyte[] abyte9 = DataOperations.loadData(s1 + "f.dat", 0, abyte0);
							sbyte[] abyte6 = abyte1;
							if (abyte9 == null)
							{
								abyte9 = DataOperations.loadData(s1 + "f.dat", 0, abyte2);
								abyte6 = abyte3;
							}
							GameGraphics.unpackImageData(animationNumber + 18, abyte9, abyte6, 9);
							l += 9;
						}
						if (Data.animationGenderModels[i1] != 0)
						{
							for (int k1 = animationNumber; k1 < animationNumber + 27; k1++)
								GameGraphics.loadImage(k1, true);

						}
					}
					catch { }
				}
				Data.animationNumber[i1] = animationNumber;
				animationNumber += 27;
				sb.AppendLine("Loaded: " + l + " frames of animation");

				/* #warning ugly fix for forcing animation count to 1143.
				if (l == 1143) break;
				*/
			endOfLoop: { }
			}
			var str = sb.ToString();
			Debug.Log("Loaded: " + l + " frames of animation");
			return true;
		}
コード例 #6
0
ファイル: GraphicsDevice.cs プロジェクト: sinshu/chaos
        public void DrawImageFixFlip(GameImage image, int width, int height, int row, int col, int x, int y, Thing thing)
        {
            if (x + width < 0) return;
            if (x - width > Settings.SCREEN_WIDTH) return;
            if (y + height < 0) return;
            if (y - height > Settings.SCREEN_HEIGHT) return;

            if (currentDrawMode != DrawMode.Alpha)
            {
                screen.BlendSrcAlpha();
                currentDrawMode = DrawMode.Alpha;
            }
            screen.SetColor(255, thing.DamageColorGreen, thing.DamageColorBlue, 255);
            screen.Blt(textures[(int)image], x, y + 1, new Rect(width * (col + 1), height * row + 1, width * col, height * (row + 1)));
        }
コード例 #7
0
ファイル: GraphicsDevice.cs プロジェクト: sinshu/chaos
        public void DrawImageAddFlipRotate90(GameImage image, int width, int height, int row, int col, int x, int y, int flipRotate, int r, int g, int b)
        {
            if (x + width < 0) return;
            if (x - width > Settings.SCREEN_WIDTH) return;
            if (y + height < 0) return;
            if (y - height > Settings.SCREEN_HEIGHT) return;

            if (currentDrawMode != DrawMode.Add)
            {
                screen.BlendAddColorAlpha();
                currentDrawMode = DrawMode.Add;
            }
            screen.SetColor(r, g, b);
            if (flipRotate % 2 == 0)
            {
                screen.BltRotate(textures[(int)image], x, y, new Rect(width * col, height * row, width * (col + 1), height * (row + 1)), flipRotate / 2 * 128, 1.0f, width / 2, height / 2);
            }
            else
            {
                switch (flipRotate / 2)
                {
                    case 0:
                        screen.BltRotate(textures[(int)image], x + width, y, new Rect(width * (col + 1), height * row, width * col, height * (row + 1)), flipRotate / 2 * 128, 1.0f, -width / 2, -height / 2);
                        break;
                    case 1:
                        screen.BltRotate(textures[(int)image], x + 2 * width, y + height, new Rect(width * (col + 1), height * row, width * col, height * (row + 1)), flipRotate / 2 * 128, 1.0f, -width / 2, -height / 2);
                        break;
                    case 2:
                        screen.BltRotate(textures[(int)image], x + width, y + 2 * height, new Rect(width * (col + 1), height * row, width * col, height * (row + 1)), flipRotate / 2 * 128, 1.0f, -width / 2, -height / 2);
                        break;
                    case 3:
                        screen.BltRotate(textures[(int)image], x, y + height, new Rect(width * (col + 1), height * row, width * col, height * (row + 1)), flipRotate / 2 * 128, 1.0f, -width / 2, -height / 2);
                        break;
                }
            }
        }
コード例 #8
0
ファイル: GraphicsDevice.cs プロジェクト: sinshu/chaos
        public void DrawImage(GameImage image, int width, int height, int x, int y, int r, int g, int b)
        {
            if (x + width < 0) return;
            if (x - width > Settings.SCREEN_WIDTH) return;
            if (y + height < 0) return;
            if (y - height > Settings.SCREEN_HEIGHT) return;

            if (currentDrawMode != DrawMode.Alpha)
            {
                screen.BlendSrcAlpha();
                currentDrawMode = DrawMode.Alpha;
            }

            screen.SetColor(r, g, b, 255);
            screen.Blt(textures[(int)image], x, y);
        }
コード例 #9
0
            /// <summary>
            /// Adds all the images that can be found in the XmlNode
            /// </summary>
            /// <param name="node">the XmlNode to search through</param>
            public void FromXmlNode(XmlNode node) {
                IEnumerator ienumImages = node.GetEnumerator();
                while (ienumImages.MoveNext()) {
                    XmlNode imageNode = (XmlNode)ienumImages.Current;

                    switch (imageNode.Name) {
                        case "fanart":
                            Fanart.Add(new GameImage(imageNode.FirstChild));
                            break;
                        case "banner":
                            Banners.Add(new GameImage(imageNode));
                            break;
                        case "screenshot":
                            Screenshots.Add(new GameImage(imageNode.FirstChild));
                            break;
                        case "boxart":
                            if (imageNode.Attributes.GetNamedItem("side").InnerText == "front") {
                                BoxartFront = new GameImage(imageNode);
                            }
                            else {
                                BoxartBack = new GameImage(imageNode);
                            }

                            break;
                    }
                }
            }
コード例 #10
0
 protected override void OnInit()
 {
     base.OnInit();
     this.m_icon          = Make <GameImage>(gameObject);
     this.m_TweenRotation = this.m_icon.GetComponent <TweenRotationEuler>();
 }
コード例 #11
0
        public void GameImageGenerateDeleteStatementTest()
        {
            var gameImage = new GameImage(1, 1, _imageData);

            Assert.AreEqual(gameImage.GenerateDeleteStatement(), "DELETE FROM GameImage WHERE Id = 1");
        }
コード例 #12
0
        public void GameImageGenerateUpdateStatementTest()
        {
            var gameImage = new GameImage(1, 1, _imageData);

            Assert.AreEqual(gameImage.GenerateUpdateStatement(), "UPDATE GameImage SET GameId = 1 WHERE Id = 1");
        }
コード例 #13
0
        public void GameImageGenerateInsertStatementTest()
        {
            var gameImage = new GameImage(1, 1, _imageData);

            Assert.AreEqual(gameImage.GenerateInsertStatment(), "INSERT INTO GameImage (GameId) VALUES (1)");
        }
コード例 #14
0
        public void GameImageDatabaseCommandsTest()
        {
            var connection = new SqlServerConnection();

            Assert.AreEqual(connection.IsConnected, false);

            var result = connection.Connect(ConnectionString, 0);

            Assert.AreEqual(result, true);


            // Add a Games

            var game = new Game(
                0,
                "Name",
                "Description");

            var insertCommand = game.GenerateInsertStatement();

            Assert.IsFalse(string.IsNullOrEmpty(insertCommand));

            var errorMessage = "";
            var insertResult = connection.ExecuteCommand(insertCommand, ref errorMessage, out var newId);

            Assert.IsTrue(insertResult);
            Assert.IsTrue(newId > 0);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);

            game.Id = newId;

            var updateGame = new Game(
                0,
                "Name1",
                "Description1");

            insertCommand = updateGame.GenerateInsertStatement();

            Assert.IsFalse(string.IsNullOrEmpty(insertCommand));

            errorMessage = "";
            insertResult = connection.ExecuteCommand(insertCommand, ref errorMessage, out newId);

            Assert.IsTrue(insertResult);
            Assert.IsTrue(newId > 0);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);

            updateGame.Id = newId;


            // Select All

            var gameImage = new GameImage();

            var selectQuery = gameImage.GenerateSelectQuery();

            Assert.IsFalse(string.IsNullOrEmpty(selectQuery));

            errorMessage = "";
            var selectResult = connection.ExecuteQuery(selectQuery, ref errorMessage);

            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
            Assert.IsNotNull(selectResult);

            var selectResultList = DataSetUtility.ToDictionaryList(selectResult.Tables[0]);

            if (selectResultList.Count > 0)
            {
                Assert.IsTrue(selectResultList.Count > 0);
            }


            // Insert

            gameImage = new GameImage(0, game.Id, _imageData);


            insertCommand = gameImage.GenerateInsertStatment();

            Assert.IsFalse(string.IsNullOrEmpty(insertCommand));

            errorMessage = "";

            insertResult = connection.ExecuteCommand(insertCommand, ref errorMessage, out newId);

            Assert.IsTrue(insertResult);
            Assert.IsTrue(newId > 0);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);

            gameImage.Id = newId;

            // Add image BLOB

            var blobUpdateCommand = connection.CreateBlobUpdateStatement(GameImage.TableName, "Image", gameImage.GeneratePrimaryKeyWhereClause());
            var blobResult        = connection.WriteBlobData(blobUpdateCommand, "Image", "varbinary", null, _imageData);

            Assert.IsTrue(blobResult);


            // Exists

            var existsQuery = gameImage.GenerateExistsQuery();

            Assert.IsFalse(string.IsNullOrEmpty(existsQuery));

            errorMessage = "";
            var existsResult = connection.ExecuteQuery(existsQuery, ref errorMessage);

            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
            Assert.IsNotNull(existsResult);

            var existsResultList = DataSetUtility.ToDictionaryList(existsResult.Tables[0]);

            var recordExists = existsResultList.Any(dictionary => (dictionary != null) && (dictionary.Count > 0));

            Assert.AreEqual(recordExists, true);


            // Select

            selectQuery = gameImage.GenerateSelectQuery();

            Assert.IsFalse(string.IsNullOrEmpty(selectQuery));

            errorMessage = "";
            selectResult = connection.ExecuteQuery(selectQuery, ref errorMessage);

            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
            Assert.IsNotNull(selectResult);

            selectResultList = DataSetUtility.ToDictionaryList(selectResult.Tables[0]);

            GameImage foundGameImage = null;

            if (selectResultList.Count > 0)
            {
                foreach (var dictionary in selectResultList.Where(dictionary => (dictionary != null) && (dictionary.Count > 0)))
                {
                    foundGameImage = GameImage.FromDictionary(dictionary);
                    break;
                }
            }

            Assert.IsNotNull(foundGameImage);

            // Read BLOB Data
            foundGameImage.Image = connection.ReadBlobData($"SELECT Image FROM {GameImage.TableName} WHERE Id = {foundGameImage.Id}", 0);

            Assert.AreNotSame(gameImage, foundGameImage);

            Assert.AreEqual(gameImage.Id, foundGameImage.Id);
            Assert.AreEqual(gameImage.GameId, foundGameImage.GameId);

            if (gameImage.Image != null)
            {
                Assert.IsTrue(gameImage.Image.SequenceEqual(foundGameImage.Image));
            }

            else
            {
                Assert.IsNull(gameImage.Image);
                Assert.IsNull(foundGameImage.Image);
            }


            // Update

            var updateGameImage = new GameImage(
                newId,
                updateGame.Id,
                _updateImageData);

            var updateCommand = updateGameImage.GenerateUpdateStatement();

            Assert.IsFalse(string.IsNullOrEmpty(updateCommand));

            errorMessage = "";
            var updateResult = connection.ExecuteCommand(updateCommand, ref errorMessage);

            Assert.AreEqual(updateResult, true);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);

            // Update image BLOB

            blobUpdateCommand = connection.CreateBlobUpdateStatement(GameImage.TableName, "Image", updateGameImage.GeneratePrimaryKeyWhereClause());
            blobResult        = connection.WriteBlobData(blobUpdateCommand, "Image", "varbinary", null, _updateImageData);

            Assert.IsTrue(blobResult);


            // Exists

            existsQuery = updateGameImage.GenerateExistsQuery();

            Assert.IsFalse(string.IsNullOrEmpty(existsQuery));

            errorMessage = "";
            existsResult = connection.ExecuteQuery(existsQuery, ref errorMessage);

            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
            Assert.IsNotNull(existsResult);

            existsResultList = DataSetUtility.ToDictionaryList(existsResult.Tables[0]);

            recordExists = existsResultList.Any(dictionary => (dictionary != null) && (dictionary.Count > 0));

            Assert.AreEqual(recordExists, true);


            // Select

            selectQuery = updateGameImage.GenerateSelectQuery();

            Assert.IsFalse(string.IsNullOrEmpty(selectQuery));

            errorMessage = "";
            selectResult = connection.ExecuteQuery(selectQuery, ref errorMessage);

            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
            Assert.IsNotNull(selectResult);

            selectResultList = DataSetUtility.ToDictionaryList(selectResult.Tables[0]);

            foundGameImage = null;

            if (selectResultList.Count > 0)
            {
                foreach (var dictionary in selectResultList.Where(dictionary => (dictionary != null) && (dictionary.Count > 0)))
                {
                    foundGameImage = GameImage.FromDictionary(dictionary);
                    break;
                }
            }

            Assert.IsNotNull(foundGameImage);

            Assert.AreNotSame(updateGameImage, foundGameImage);

            // Read BLOB Data
            foundGameImage.Image = connection.ReadBlobData($"SELECT Image FROM {GameImage.TableName} WHERE Id = {foundGameImage.Id}", 0);

            Assert.AreEqual(updateGameImage.Id, foundGameImage.Id);
            Assert.AreEqual(updateGameImage.GameId, foundGameImage.GameId);

            if (updateGameImage.Image != null)
            {
                Assert.IsTrue(updateGameImage.Image.SequenceEqual(foundGameImage.Image));
            }

            else
            {
                Assert.IsNull(updateGameImage.Image);
                Assert.IsNull(foundGameImage.Image);
            }


            // Delete

            var deleteCommand = gameImage.GenerateDeleteStatement();

            var deleteGameImage = gameImage.GenerateDeleteStatement();

            Assert.IsFalse(string.IsNullOrEmpty(deleteCommand));

            errorMessage = "";
            var deleteResult = connection.ExecuteCommand(deleteCommand, ref errorMessage);

            Assert.AreEqual(deleteResult, true);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);


            // Exists

            existsQuery = gameImage.GenerateExistsQuery();

            Assert.IsFalse(string.IsNullOrEmpty(existsQuery));

            errorMessage = "";
            existsResult = connection.ExecuteQuery(existsQuery, ref errorMessage);

            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
            Assert.IsNotNull(existsResult);

            existsResultList = DataSetUtility.ToDictionaryList(existsResult.Tables[0]);

            recordExists = existsResultList.Any(dictionary => (dictionary != null) && (dictionary.Count > 0));

            Assert.IsFalse(recordExists);


            // Select

            selectQuery = gameImage.GenerateSelectQuery();

            Assert.IsFalse(string.IsNullOrEmpty(selectQuery));

            errorMessage = "";
            selectResult = connection.ExecuteQuery(selectQuery, ref errorMessage);

            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
            Assert.IsNotNull(selectResult);

            selectResultList = DataSetUtility.ToDictionaryList(selectResult.Tables[0]);

            foundGameImage = null;

            if (selectResultList.Count > 0)
            {
                foreach (var dictionary in selectResultList.Where(dictionary => (dictionary != null) && (dictionary.Count > 0)))
                {
                    foundGameImage = GameImage.FromDictionary(dictionary);
                    break;
                }
            }

            Assert.IsNull(foundGameImage);


            // Delete the games

            deleteCommand = game.GenerateDeleteStatement();

            Assert.IsFalse(string.IsNullOrEmpty(deleteCommand));

            errorMessage = "";
            deleteResult = connection.ExecuteCommand(deleteCommand, ref errorMessage);

            Assert.AreEqual(deleteResult, true);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);

            deleteCommand = updateGame.GenerateDeleteStatement();

            Assert.IsFalse(string.IsNullOrEmpty(deleteCommand));

            errorMessage = "";
            deleteResult = connection.ExecuteCommand(deleteCommand, ref errorMessage);

            Assert.AreEqual(deleteResult, true);
            Assert.AreEqual(string.IsNullOrEmpty(errorMessage), true);
        }
コード例 #15
0
        public void GameImageGenerateExistsQueryTest()
        {
            var gameImage = new GameImage(1, 1, _imageData);

            Assert.AreEqual(gameImage.GenerateExistsQuery(), "SELECT Id FROM GameImage WHERE Id = 1");
        }
コード例 #16
0
		public static bool LoadMedia() //Sprites
		{
			if (GameGraphics == null) GameGraphics = new GameImage(512, 346, 4000);

			sbyte[] media = UnpackData("media.jag", "2d graphics", 20);
			if (media == null)
			{
				return false;
			}


			baseInventoryPic = 2000;
			baseScrollPic = baseInventoryPic + 100;
			baseItemPicture = baseScrollPic + 50;
			baseLoginScreenBackgroundPic = baseItemPicture + 1000;
			baseProjectilePic = baseLoginScreenBackgroundPic + 10;
			baseTexturePic = baseProjectilePic + 50;
			subTexturePic = baseTexturePic + 10;

			sbyte[] abyte1 = DataOperations.loadData("index.dat", 0, media);
			GameGraphics.unpackImageData(baseInventoryPic, DataOperations.loadData("inv1.dat", 0, media), abyte1, 1);
			GameGraphics.unpackImageData(baseInventoryPic + 1, DataOperations.loadData("inv2.dat", 0, media), abyte1, 6);
			GameGraphics.unpackImageData(baseInventoryPic + 9, DataOperations.loadData("bubble.dat", 0, media), abyte1, 1);
			GameGraphics.unpackImageData(baseInventoryPic + 10, DataOperations.loadData("runescape.dat", 0, media), abyte1, 1);
			GameGraphics.unpackImageData(baseInventoryPic + 11, DataOperations.loadData("splat.dat", 0, media), abyte1, 3);
			GameGraphics.unpackImageData(baseInventoryPic + 14, DataOperations.loadData("icon.dat", 0, media), abyte1, 8);
			GameGraphics.unpackImageData(baseInventoryPic + 22, DataOperations.loadData("hbar.dat", 0, media), abyte1, 1);
			GameGraphics.unpackImageData(baseInventoryPic + 23, DataOperations.loadData("hbar2.dat", 0, media), abyte1, 1);
			GameGraphics.unpackImageData(baseInventoryPic + 24, DataOperations.loadData("compass.dat", 0, media), abyte1, 1);
			GameGraphics.unpackImageData(baseInventoryPic + 25, DataOperations.loadData("buttons.dat", 0, media), abyte1, 2);
			GameGraphics.unpackImageData(baseScrollPic, DataOperations.loadData("scrollbar.dat", 0, media), abyte1, 2);
			GameGraphics.unpackImageData(baseScrollPic + 2, DataOperations.loadData("corners.dat", 0, media), abyte1, 4);
			GameGraphics.unpackImageData(baseScrollPic + 6, DataOperations.loadData("arrows.dat", 0, media), abyte1, 2);
			GameGraphics.unpackImageData(baseProjectilePic, DataOperations.loadData("projectile.dat", 0, media), abyte1, Data.spellProjectileCount);

			int l = Data.highestLoadedPicture;
			for (int i1 = 1; l > 0; i1++)
			{
				int j1 = l;
				l -= 30;
				if (j1 > 30)
					j1 = 30;
				GameGraphics.unpackImageData(baseItemPicture + (i1 - 1) * 30, DataOperations.loadData("objects" + i1 + ".dat", 0, media), abyte1, j1);

			}

			//GameGraphics.UpdateGameImage();
			GameGraphics.loadImage(baseInventoryPic);
			GameGraphics.loadImage(baseInventoryPic + 9);
			for (int k1 = 10 /*11*/; k1 <= /* 26 */ 2000; k1++)
				GameGraphics.loadImage(baseInventoryPic + k1);


			/*
			for (int l1 = 0; l1 < Data.spellProjectileCount; l1++)
				GameGraphics.loadImage(baseProjectilePic + l1);

			for (int i2 = 0; i2 < Data.highestLoadedPicture; i2++)			
				GameGraphics.loadImage(baseProjectilePic + i2);
			*/

			return true;

		}
コード例 #17
0
        public async Task <IActionResult> Create([FromForm(Name = "imageFile")] IFormFile imageFile, [Bind("GameImageId,GameId")] GameImage gameImage, bool isThumbnail = false)
        {
            if (true) //ModelState.IsValid
            {
                string filePath = UploadedFile(gameImage.GameId, imageFile, isThumbnail);
                gameImage.GameImagePath = filePath;
                _context.Add(gameImage);
                await _context.SaveChangesAsync();

                //return RedirectToAction(nameof(Index));
                return(RedirectToAction("Admin", "Games"));
            }
            //ViewData["GameId"] = new SelectList(_context.Game, "GameId", "GameName", gameImage.GameId);
            ViewData["GameId"] = gameImage.GameId;
            return(View(gameImage));
        }
コード例 #18
0
 protected override void OnInit()
 {
     base.OnInit();
     m_bg   = Make <GameImage>("Image_BG");
     m_icon = m_bg.Make <GameImage>("Image");
 }
コード例 #19
0
ファイル: GameImage.cs プロジェクト: dnaismyth/Learning-App
 /**************************************************************************/
 /************************ END GETTER/SETTERS *****************************/
 /************************************************************************/
 // Method that will allow you to search for a GameImage object using the letter
 public GameImage findWithLetter(string s, GameImage [] g)
 {
     for(int i = 0; i < g.Length; i++)
     {
         if (g[i].getLetter() == s && g[i].getCheck() == false) // check to see if the letter is within the provided array, and that it hasn't already been set to true (caught)
         {
             return g[i];
         }
     }
     return null;
 }
コード例 #20
0
        protected override void OnInit()
        {
            m_back_btn = this.Make <GameButton>("btnBack");

            m_body_tex   = this.Make <GameTexture>("BG_Frame:Portrait");
            m_level_icon = this.Make <GameImage>("Image_Level:icon");
            m_name_title = this.Make <GameLabel>("Image_Level:title");

            m_tool_icons = new List <IconGrayTransparent>();
            m_tool_icons.Add(this.Make <IconGrayTransparent>("Panel_Tools:Image0"));
            m_tool_icons.Add(this.Make <IconGrayTransparent>("Panel_Tools:Image1"));
            m_tool_icons.Add(this.Make <IconGrayTransparent>("Panel_Tools:Image2"));
            m_tool_icons.Add(this.Make <IconGrayTransparent>("Panel_Tools:Image3"));
            m_tool_icons.Add(this.Make <IconGrayTransparent>("Panel_Tools:Image4"));

            for (int i = 0; i < m_tool_icons.Count; ++i)
            {
                m_tool_icons[i].gameObject.name = i.ToString();
                m_tool_icons[i].Disable_alpha   = 0.9f;
            }

            m_tool_tip = this.Make <ToolTip>("Panel_Tools:Tips_BG");

            m_item_roots = new List <GameUIComponent>
            {
                this.Make <GameUIComponent>("Panel_Items:Image0"),
                this.Make <GameUIComponent>("Panel_Items:Image1:"),
                this.Make <GameUIComponent>("Panel_Items:Image2"),
                this.Make <GameUIComponent>("Panel_Items:Image3"),
            };

            m_items = new List <GameImage>
            {
                this.Make <GameImage>("Panel_Items:Image0:Icon"),
                this.Make <GameImage>("Panel_Items:Image1:Icon"),
                this.Make <GameImage>("Panel_Items:Image2:Icon"),
                this.Make <GameImage>("Panel_Items:Image3:Icon"),
            };

            m_items_nums = new List <GameLabel>
            {
                this.Make <GameLabel>("Panel_Items:Image0:Text_Num"),
                this.Make <GameLabel>("Panel_Items:Image1:Text_Num"),
                this.Make <GameLabel>("Panel_Items:Image2:Text_Num"),
                this.Make <GameLabel>("Panel_Items:Image3:Text_Num"),
            };

            m_items_max_nums = new List <GameLabel>
            {
                this.Make <GameLabel>("Panel_Items:Image0:Text_Max"),
                this.Make <GameLabel>("Panel_Items:Image1:Text_Max"),
                this.Make <GameLabel>("Panel_Items:Image2:Text_Max"),
                this.Make <GameLabel>("Panel_Items:Image3:Text_Max"),
            };


            m_item_progress = new List <GameImage>
            {
                this.Make <GameImage>("Panel_Items:Image0:Icon_progress"),
                this.Make <GameImage>("Panel_Items:Image1:Icon_progress"),
                this.Make <GameImage>("Panel_Items:Image2:Icon_progress"),
                this.Make <GameImage>("Panel_Items:Image3:Icon_progress"),
            };

            m_employ_btn            = this.Make <GameButton>("btnEmploy");
            m_employ_btn_label      = this.Make <GameLabel>("btnEmploy:Text");
            m_employ_btn_label.Text = LocalizeModule.Instance.GetString("UI_Police.employ");

            m_upgrade_btn            = this.Make <GameButton>("btnUpgrade");
            m_upgrade_btn_label      = this.Make <GameLabel>("btnUpgrade:Text");
            m_upgrade_btn_label.Text = LocalizeModule.Instance.GetString("UI_Police.upgrade");

            m_upgrade_effects = new List <GameUIEffect>()
            {
                this.Make <GameUIEffect>("Effect_Root:UI_jingyuanpaiqian_xunzhang01"),
                this.Make <GameUIEffect>("Effect_Root:UI_jingyuanpaiqian_xunzhang02"),
                this.Make <GameUIEffect>("Effect_Root:UI_jingyuanpaiqian_xunzhang03"),
                this.Make <GameUIEffect>("Effect_Root:UI_jingyuanpaiqian_xunzhang04"),
            };

            int effect_i = 0;

            m_upgrade_effects.ForEach((item) => { item.EffectPrefabName = string.Format("UI_jingyuanpaiqian_xunzhang0{0}.prefab", ++effect_i); });
        }
コード例 #21
0
 void createPairs()
 {
     Debug.Log(imageName.ToString());
     imageObjects = new GameImage[imageName.Length]; // initialize our array to the length of the imageName
     char[] imgChars = imageName.ToCharArray();  // split the image name into individual characters to check for matching
     for (int i = 0; i < imgChars.Length; i++)
     {
         //checkCaught.Add(imgChars[i].ToString(), false); // add all of the letters to a key value pair, initial bool = false because not yet caught
         imageObjects[i] = new GameImage(i, imgChars[i].ToString(), false); // create GameImage objects and store into array
         Debug.Log("These letters are in the dictionary: " + imageObjects[i].getLetter());
     }
     fontReady = true;
 }
コード例 #22
0
 protected override void OnInit()
 {
     m_icon     = this.Make <GameImage>("Image (1)");
     m_desc_txt = m_icon.Make <GameLabel>("Text (1)");
 }
コード例 #23
0
ファイル: GraphicsDevice.cs プロジェクト: sinshu/chaos
        public void DrawImage2(GameImage image, int srcX, int srcY, int width, int height, int x, int y)
        {
            if (x + width < 0) return;
            if (x - width > Settings.SCREEN_WIDTH) return;
            if (y + height < 0) return;
            if (y - height > Settings.SCREEN_HEIGHT) return;

            if (currentDrawMode != DrawMode.Alpha)
            {
                screen.BlendSrcAlpha();
                currentDrawMode = DrawMode.Alpha;
            }

            screen.SetColor(255, 255, 255, 255);
            screen.Blt(textures[(int)image], x, y, new Rect(srcX, srcY, srcX + width, srcY + height));
        }
コード例 #24
0
 public PrologueClouds(TextAnimationController controller, GameImage gameImage) : base(controller, gameImage)
 {
 }
コード例 #25
0
ファイル: GraphicsDevice.cs プロジェクト: sinshu/chaos
        public void DrawImageAlpha(GameImage image, int width, int height, int row, int col, int x, int y, int alpha, int r, int g, int b)
        {
            if (x + width < 0) return;
            if (x - width > Settings.SCREEN_WIDTH) return;
            if (y + height < 0) return;
            if (y - height > Settings.SCREEN_HEIGHT) return;

            if (currentDrawMode != DrawMode.Alpha)
            {
                screen.BlendSrcAlpha();
                currentDrawMode = DrawMode.Alpha;
            }

            screen.SetColor(r, g, b, alpha);
            screen.Blt(textures[(int)image], x, y, new Rect(width * col, height * row, width * (col + 1), height * (row + 1)));
        }
コード例 #26
0
 public BGLeft(TextAnimationController controller, GameImage gameImage) : base(controller, gameImage)
 {
 }
コード例 #27
0
ファイル: GraphicsDevice.cs プロジェクト: sinshu/chaos
        public void DrawImageRotateAlpha(GameImage image, int width, int height, int row, int col, int x, int y, int centerX, int centerY, int angle, int alpha)
        {
            int range = (int)Math.Ceiling(Math.Sqrt(width * width + height * height));
            if (x + range < 0) return;
            if (x - range > Settings.SCREEN_WIDTH) return;
            if (y + range < 0) return;
            if (y - range > Settings.SCREEN_HEIGHT) return;

            if (currentDrawMode != DrawMode.Alpha)
            {
                screen.BlendSrcAlpha();
                currentDrawMode = DrawMode.Alpha;
            }

            screen.SetColor(255, 255, 255, alpha);
            screen.BltRotate(textures[(int)image], x - centerX, y - centerY, new Rect(width * col, height * row, width * (col + 1), height * (row + 1)), (int)Math.Round((double)angle / 360.0 * 512.0), 1, centerX, centerY);
        }
コード例 #28
0
		public static bool LoadTextures()
		{
			if (GameGraphics == null) GameGraphics = new GameImage(512, 346, 4000);
			sbyte[] _textureData = UnpackData("textures.jag", "Textures", 50);
			if (_textureData == null)
			{

				return false;
			}

			var baseInventoryPic = 2000;
			var baseScrollPic = baseInventoryPic + 100;
			var baseItemPicture = baseScrollPic + 50;
			var baseLoginScreenBackgroundPic = baseItemPicture + 1000;
			var baseProjectilePic = baseLoginScreenBackgroundPic + 10;
			var baseTexturePic = baseProjectilePic + 50;
			var subTexturePic = baseTexturePic + 10;

			sbyte[] indexData = DataOperations.loadData("index.dat", 0, _textureData);
			//gameCamera.CreateTexture(Data.textureCount, 7, 11);
			for (int l = 0; l < Data.textureCount; l++)
			{
				String s1 = Data.textureName[l];
				sbyte[] textureData = DataOperations.loadData(s1 + ".dat", 0, _textureData);



				var texture = TextureManager.CreateTexture(baseTexturePic + l, textureData, indexData, 1);



				if (l == 8 || l == 16 || l == 33 || l == 34)
				{


					// Rotate clockwise..
					if (texture != null && texture.Length == 1)
					{
						//	var t = texture[0];

						//	TextureBaker baker = new TextureBaker(Game1.DeviceInstance, new Vector2(t.Height, t.Width));
						//	baker.BakeTexture(t, RotateFlipType.Rotate90FlipNone);
						//	texture[0] = baker.GetTexture();

						texture[0] = TextureManager.Rotate(texture[0], RotateFlipType.Rotate270FlipNone);

						texture[0] = TextureManager.Rotate(texture[0], RotateFlipType.Rotate180FlipNone);
					}

				}


				String s2 = Data.textureSubName[l];
				if (string.IsNullOrEmpty(s2))
				{
					if (texture != null && texture.Length > 0)
					{
						for (var j = 0; j < texture.Length; j++)
						{

							//var bakerman = new TextureBaker(Game1.DeviceInstance, new Vector2(texture[j].Height, texture[j].Width));
							//bakerman.BakeTexture(texture[j], RotateFlipType.Rotate270FlipNone);
							//texture[j] = bakerman.GetTexture();
							/*
							using (var stream = System.IO.File.Create("c:/jpg/" + (subTexturePic + l) + ".png"))
							{
								texture[j].SaveAsPng(stream, texture[j].Width, texture[j].Height);
							}
							 */

							texture[j] = TextureManager.Rotate(texture[j], RotateFlipType.Rotate270FlipNone);

							texture[j] = TextureManager.Rotate(texture[j], RotateFlipType.Rotate180FlipNone);

							TextureManager.Textures.Add(new TextureData((subTexturePic + l/*textureIndex*/), texture[j]));

						}
					}
				}




				if (!string.IsNullOrEmpty(s2))
				{
					Texture2D backTexture = null;
					if (texture != null && texture.Any())
					{
						backTexture = texture[0];
					}
					sbyte[] subTextureData = DataOperations.loadData(s2 + ".dat", 0, _textureData);
					var subTexture = TextureManager.CreateTexture(baseTexturePic, subTextureData, indexData, 1, backTexture /*null*/);
					if (subTexture != null && subTexture.Length > 0)
					{
						foreach (var t in subTexture)
						{
							/*
							using (var stream = System.IO.File.Create("c:/jpg/" + (subTexturePic + l) + ".png"))
							{
								t.SaveAsPng(stream, t.Width, t.Height);
							}
							 * */


							var t2 = TextureManager.Rotate(t, RotateFlipType.Rotate180FlipNone);

							TextureManager.Textures.Add(new TextureData((subTexturePic /*baseTexturePic*/+ l /*textureIndex*/), t2));

						}
					}
					//	gameGraphics.unpackImageData(baseTexturePic, abyte3, abyte1, 1);
					//	gameGraphics.drawPicture(0, 0, baseTexturePic);
				}


			}

			TextureManager.GenerateTextureAtlas();

			return true;
		}