Example #1
0
    public void InitializeL(string Codef)
    {
        if (File.Exists(Application.persistentDataPath + "/" + Codef + ".dat"))
        {
            BinaryFormatter BF   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + "/" + Codef + ".dat", FileMode.Open);
            Poke            data = (Poke)BF.Deserialize(file);

            file.Close();

            evHP  = data.evHP;
            ivHP  = data.ivHP;
            ivATK = data.ivATK;
            evATK = data.evATK;
            ivDEF = data.ivDEF;
            evDEF = data.evDEF;
            ivSPA = data.ivSPA;
            evSPA = data.evSPA;
            ivSPD = data.ivSPD;
            evSPD = data.evSPD;
            ivSPE = data.ivSPE;
            evSPE = data.evSPE;
            lvl   = data.lvl;
            XP    = data.XP;
            Nick  = data.Nick;
            male  = data.male;
            Shiny = data.Shiny;
        }

        if (Shiny)
        {
            Mat.MatEX(this.transform.GetChild(0).gameObject);
        }
    }
Example #2
0
        static void Main(string[] args)
        {
            Poke charmander = new Poke()
            {
                HP_Base             = 39,
                Attack_Base         = 52,
                Defence_Base        = 43,
                SpecialAttack_Base  = 60,
                SpecialDefence_Base = 50,
                Speed_Base          = 65,
                //Naam = "Charmander",
                //Type = "Fire",
                //NummerPoke = 004
            };

            Poke bulbasaur = new Poke()
            {
                HP_Base             = 45,
                Attack_Base         = 49,
                Defence_Base        = 49,
                SpecialAttack_Base  = 65,
                SpecialDefence_Base = 65,
                Speed_Base          = 45,
            };

            // Level-up tester
            Console.WriteLine("Tot welke level wilt u leveren?");
            int levels = Convert.ToInt32(Console.ReadLine());

            for (int i = 0; i < levels; i++)
            {
                charmander.VerhoogLevel();
            }
            charmander.ToonInfo();
        }
Example #3
0
        public static MessageChainBuilder AddPoke(this MessageChainBuilder builder, PokeType type)
        {
            Poke poke = new Poke(type);

            builder.Add(poke);
            return(builder);
        }
Example #4
0
    private void Save()
    {
        BinaryFormatter BF   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/" + CODE + ".dat");

        Poke data = new Poke();

        data.evHP  = evHP;
        data.ivHP  = ivHP;
        data.evATK = evATK;
        data.ivATK = ivATK;
        data.evDEF = evDEF;
        data.ivDEF = ivDEF;
        data.evSPA = evSPA;
        data.ivSPA = ivSPA;
        data.evSPD = evSPD;
        data.ivSPD = ivSPD;
        data.evSPE = evSPE;
        data.ivSPE = ivSPE;
        data.lvl   = lvl;
        data.XP    = XP;
        data.Nick  = Nick;
        data.male  = male;
        data.Shiny = Shiny;
        BF.Serialize(file, data);
        file.Close();
    }
Example #5
0
 public bool SavePokemon(Poke pokemon)
 {
     try
     {
         RealmInstance.Write(() =>
         {
             RealmInstance.Add(new PokeFav
             {
                 PokemonId     = pokemon.PokemonId,
                 Sprite        = pokemon.Sprite,
                 SpriteArray   = pokemon.SpriteArray,
                 LocationLong  = pokemon.LocationLong,
                 LocationLat   = pokemon.LocationLat,
                 Abilities     = pokemon.Abilities,
                 Moves         = pokemon.Moves,
                 Types         = pokemon.Types,
                 PokedexNumber = pokemon.PokedexNumber,
                 Name          = pokemon.Name
             });
         });
         // RealmInstance.Write(() =>
         //{
         //    var pokefav = RealmInstance.CreateObject<PokeFav>(pokemon);
         //    pokefav.PokemonId = pokemon.PokemonId;
         //});
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Example #6
0
        public string Format(MessageChain chain)
        {
            var cmps = new LinkedList <object>();

            foreach (var comp in chain)
            {
                cmps.AddLast(comp switch
                {
                    Plain plain => new { type = "text", data = new { text = plain.Text } },
                    Face face => new { type = "face", data = new { id = face.FaceId } },
                    At at => new { type = "at", data = new { qq = at.TargetId.ToString() } },
                    ImageBase {
                        Source: UrlSource source
                    } image => new { type = "image", data = new { file = source.Url.AbsoluteUri, type = image is Flash ? "flash" : "image", cache = 0 } },
                    ImageBase {
                        Source: StreamSource source
                    } image => new { type = "image", data = new { file = GetBase64Url(source.Data), type = image is Flash ? "flash" : "image", cache = 0 } },
                    AtAll atall => new { type = "at", data = new { qq = "atall" } },
                    Quote quote => new { type = "reply", data = new { id = quote.MessageId } },
                    Poke poke => new { type = "poke", data = new { type = ((int)poke.Name).ToString(), id = "-1" } },
                    XmlContent xml => new { type = "xml", data = new { data = xml.Content } },
                    JsonContent json => new { type = "json", data = new { data = json.Content } },

                    Music music => new
                    {
                        type = "music",
                        data = new
                        {
                            type = music.Type switch
                            {
                                Music.MusicSource.QqMusic => "qq",
                                Music.MusicSource.Music163 => "163",
                                Music.MusicSource.XiaMi => "xm"
                            },
Example #7
0
        public static void SendPokeByMail(Poke p)
        {
            Email pokeEmail = new Email();
            Users u         = ServerUtils._usersDict[p.To];

            pokeEmail.To   = u.email;
            pokeEmail.From = ServerUtils._usersDict[p.From].email;

            StringBuilder sb = new StringBuilder();

            switch (p.Type)
            {
            case enPokeType.Invoker:
                pokeEmail.subject = string.Format("You got {0} from {1}", Utils.getMoodName(p.PokeMood), ServerUtils._usersDict[p.From].userName);
                break;

            case enPokeType.Reply:
                pokeEmail.subject = string.Format("Reply From {0}", ServerUtils._usersDict[p.From].userName);
                break;

            case enPokeType.PlainMessage:
                pokeEmail.subject = string.Format("Message from {0}", ServerUtils._usersDict[p.From].userName);
                break;
            }

            pokeEmail.Body = p.Comment;

            EmailManager.Enqueue(pokeEmail);
        }
Example #8
0
        public void sendPoke(float size)
        {
            bool sent;
            Poke info = new Poke();

            info.ModID = _modID;
            info.Size  = size;
            sent       = MyAPIGateway.Multiplayer.SendMessageToOthers(_modID, MyAPIGateway.Utilities.SerializeToBinary(info), true);
        }
Example #9
0
    private void OnTriggerExit(Collider other)
    {
        HandState hand = other.gameObject.GetComponent <HandState>();
        Poke      poke = other.gameObject.GetComponent <Poke>();

        if ((hand != null || poke != null) && pressed)
        {
            pressed = false;
        }
    }
Example #10
0
        private Bitmap GetPhoto()
        {
            var bitMap = (Bitmap)Resources.ResourceManager.GetObject(Poke.ToString());

            if (bitMap == null)
            {
                Console.WriteLine(@"Pokemon image not added");
                return(null);
            }
            return(new Bitmap(bitMap));
        }
Example #11
0
    private void OnTriggerEnter(Collider other)
    {
        HandState hand = other.gameObject.GetComponent <HandState>();
        Poke      poke = other.gameObject.GetComponent <Poke>();

        if ((hand != null || poke != null) && !pressed)
        {
            Application.OpenURL(address);

            pressed = true;
        }
    }
Example #12
0
    private void OnTriggerEnter(Collider other)
    {
        HandState hand = other.gameObject.GetComponent <HandState>();
        Poke      poke = other.gameObject.GetComponent <Poke>();

        if ((hand != null || poke != null) && !pressed)
        {
            TriggerProc();

            pressed = true;
        }
    }
Example #13
0
        public static Poke getPoke(Poke poke)
        {
            Poke Pokemon = null;

            using (SQLiteConnection m_dbConnection = new SQLiteConnection(String.Format("Data Source={0};Version=3;", filePath)))
            {
                Pokemon = m_dbConnection.Query <Poke>(String.Format("Select * from Pokemons where Name = '{0}' LIMIT 1", poke.Name)).FirstOrDefault();
                List <Move> pokeMoves = m_dbConnection.Query <Move>(String.Format("Select Moves.Id, Moves.Name, Moves.Type, PokemonMoves.Damage ,PokemonMoves.BaseWheelSize, Moves.Description From PokemonMoves inner join Pokemons on PokemonMoves.Id_Pokemon = Pokemons.Id and Pokemons.Id = {0} inner join Moves on Moves.Id = PokemonMoves.Id_Moves", Pokemon.Id)).ToList();
                Pokemon.Moves = pokeMoves;
            }

            return(Pokemon);
        }
Example #14
0
    //private void OnTriggerEnter(Collider other)
    //{
    //    HandState hand = other.gameObject.GetComponent<HandState>();
    //    Poke poke = other.gameObject.GetComponent<Poke>();

    //    if (hand != null || poke != null)
    //    {
    //        prevMenu.SetActive(true);
    //        transform.parent.gameObject.SetActive(false);
    //    }
    //}

    private void OnTriggerEnter(Collider other)
    {
        HandState hand = other.gameObject.GetComponent <HandState>();
        Poke      poke = other.gameObject.GetComponent <Poke>();

        if ((hand != null || poke != null) && !pressed)
        {
            prevMenu.SetActive(true);
            transform.parent.gameObject.SetActive(false);

            pressed = true;
        }
    }
Example #15
0
            string CodeSelector(MessageElement comp)
            {
                return(comp switch
                {
                    At it => it.TargetId.ToString(),
                    AtAll it => string.Empty,
                    Face it => it.FaceId.ToString(),
                    ImageBase it when it.Source != null && it.Source is UrlSource => $"{it.ImageId},{((UrlSource)it.Source).Url.AbsoluteUri}",
                    Poke it => it.Name.ToString(),
                    Quote it => it.MessageId.ToString(),
                    Source it => it.MessageId.ToString(),

                    _ => throw new NotImplementedException()
                });
Example #16
0
            string CodeSelector(MessageComponent comp)
            {
                return(comp switch
                {
                    At it => it.TargetId.ToString(),
                    AtAll it => string.Empty,
                    Face it => it.FaceId.ToString(),
                    ImageBase it => $"{it.ImageId},{it.Url}",
                    Poke it => it.Name.ToString(),
                    Quote it => it.MessageId.ToString(),
                    Source it => it.MessageId.ToString(),

                    _ => throw new NotImplementedException()
                });
Example #17
0
    private void OnTriggerEnter(Collider other)
    {
        HandState hand = other.gameObject.GetComponent <HandState>();
        Poke      poke = other.gameObject.GetComponent <Poke>();

        if ((hand != null || poke != null) && !pressed)
        {
            foreach (GameObject obj in objs)
            {
                obj.SetActive(obj.activeSelf ? false : true);
            }

            pressed = true;
        }
    }
Example #18
0
        public void getPoke(byte[] data)
        {
            var  message = MyAPIGateway.Utilities.SerializeFromBinary <Poke>(data);
            Poke info    = new Poke();

            try
            {
                info = message;
                if (info.ModID == _modID)
                {
                    showRange(info.Size);
                }
            }
            catch (Exception ex) {}
        }
Example #19
0
        public static bool InitializeSQLiteDB()
        {
            var result = false;

            if (!File.Exists(filePath))
            {
                createDB(filePath);
                using (SQLiteConnection m_dbConnection = new SQLiteConnection(String.Format("Data Source={0};Version=3;", filePath)))
                {
                    List <Move> allMoves = new List <Move>();
                    List <Poke> allPoke  = new List <Poke>();
                    JArray      o1       = JArray.Parse(File.ReadAllText(@"C:\Users\FrIcK\Documents\Visual Studio 2017\Projects\PokeBasic\PokeBasic\JSON\pokeExtract_NoStarsStrt.json"));
                    foreach (var poke in o1)
                    {
                        Console.WriteLine(poke["Name"]);
                        Poke pok = new Poke((string)poke["Name"], (string)poke["Url"], (int)poke["Id"], (int)poke["Movement"], poke["Moves"].ToList());
                        allPoke.Add(pok);
                        foreach (var move in poke["Moves"])
                        {
                            Move newMove = new Move((string)move["Name"], (string)move["Notes"], (string)move["Type"]);
                            if (!allMoves.Any(x => x.Name.Equals(newMove.Name)))
                            {
                                allMoves.Add(newMove);
                            }
                        }
                    }
                    string sqlIns = string.Empty;
                    foreach (var move in allMoves)
                    {
                        m_dbConnection.Execute(string.Format("insert into Moves (Name, Description, Type) values ('{0}', '{1}', '{2}')", move.Name, move.Description, move.Type));
                    }
                    foreach (var poke in allPoke)
                    {
                        m_dbConnection.Execute(string.Format("insert into Pokemons (Name, Url, Id_Pokemon, Movement) values ('{0}', '{1}', {2}, {3})", poke.Name, poke.Url, poke.Id, poke.Movement));

                        DbPokemon Pokemon = m_dbConnection.Query <DbPokemon>(String.Format("Select * from Pokemons where Id_Pokemon = {0} LIMIT 1", poke.Id)).FirstOrDefault();
                        foreach (var move in poke.Moves)
                        {
                            Move dbMove = m_dbConnection.Query <Move>(String.Format("Select * from Moves where Name = '{0}' LIMIT 1", move.Name)).FirstOrDefault();
                            move.Id = dbMove.Id;
                            m_dbConnection.Execute(string.Format("insert into PokemonMoves(Id_Pokemon, Id_Moves, BaseWheelSize, Damage) Values({0}, {1}, {2}, {3})", Pokemon.Id, dbMove.Id, move.BaseWheelSize, move.Damage));
                        }
                    }
                }
            }
            return(result);
        }
Example #20
0
 public bool RemovePokemon(Poke pokemon)
 {
     try
     {
         var obj = RealmInstance.All <PokeFav>().FirstOrDefault(b => b.PokemonId == pokemon.PokemonId);
         using (var trans = RealmInstance.BeginWrite())
         {
             RealmInstance.Remove(obj);
             trans.Commit();
         }
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
        public MapPageViewModel(INavigationService navigationService, IPokemonService pokemonService)
            : base(navigationService)
        {
            Title              = "Mapa de Pokemons";
            _pokemonService    = pokemonService;
            _navigationService = navigationService;

            Map       = new CustomMap();
            CustomMap = new CustomMap
            {
                MapType       = MapType.Street,
                WidthRequest  = App.ScreenWidth,
                HeightRequest = App.ScreenHeight
            };
            //var pins = new List<CustomPin>();
            _pokemon = new Poke();
        }
Example #22
0
        public void PokeReply(Poke p)
        {
            Guid          userID    = p.To;
            ClientMessage clientMsg = getClientMessage(userID);

            if (clientMsg == null)
            {
                clientMsg = new ClientMessage()
                {
                    UserID = userID, UpdatedOn = DateTime.UtcNow
                };
                _clientMessages.Add(userID, clientMsg);
            }


            clientMsg.AddPoke(p);
            addToRecentlyPokedList(userID);
            AddMessageToDirtyQueue(userID);
        }
Example #23
0
    private void OnTriggerEnter(Collider other)
    {
        HandState hand = other.gameObject.GetComponent <HandState>();
        Poke      poke = other.gameObject.GetComponent <Poke>();

        if ((hand != null || poke != null) && !pressed)
        {
            if (sound != null)
            {
                if (sound.clip != null)
                {
                    sound.PlayOneShot(sound.clip);
                }
            }

            TriggerProc();

            pressed = true;
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        HandState hand = other.gameObject.GetComponent <HandState>();
        Poke      poke = other.gameObject.GetComponent <Poke>();

        if ((hand != null || poke != null) && !pressed)
        {
            if (!obj.gameObject.activeSelf && makeActive)
            {
                obj.gameObject.SetActive(true);
            }

            if (obj.gameObject.activeSelf)
            {
                obj.position = pos;
                obj.rotation = Quaternion.Euler(rot);
            }

            pressed = true;
        }
    }
Example #25
0
    private void OnTriggerEnter(Collider other)
    {
        HandState hand = other.gameObject.GetComponent <HandState>();
        Poke      poke = other.gameObject.GetComponent <Poke>();

        if ((hand != null || poke != null) && !pressed)
        {
            switch (type)
            {
            case Type.Accept:
                rMan.UpdateServerRecording();
                break;

            case Type.Decline:
                break;

            default: break;
            }

            pressed = true;
        }
    }
Example #26
0
        public static List <Poke> FindPokes(Bitmap table, Teams team, PictureBox pictureBox1 = null)
        {
            var matches          = new List <TemplateMatch>();
            var result           = new List <Poke>();
            var pokeSpriteType   = team.Equals(Teams.Own) ? @"c:\users\frick\documents\visual studio 2017\Projects\PokeBasic\PokeBasic\Pokes\Back\" : @"c:\users\frick\documents\visual studio 2017\Projects\PokeBasic\PokeBasic\Pokes\Face\";
            var files            = Directory.GetFiles(pokeSpriteType);
            int pokeFoundCounter = 0;

            foreach (var fileName in files)
            {
                var pokePositions = IsPokeInImage(table, fileName).ToList();
                matches.AddRange(pokePositions);
                foreach (var match in pokePositions)
                {
                    var tPoke  = new Poke(Path.GetFileNameWithoutExtension(fileName), match.Rectangle.X, match.Rectangle.Y);
                    var ttPoke = DBHandler.getPoke(tPoke);
                    ttPoke.Coords = tPoke.Coords;
                    result.Add(ttPoke);
                }
            }
            BitmapData data = table.LockBits(
                new Rectangle(0, 0, table.Width, table.Height),
                ImageLockMode.ReadWrite, table.PixelFormat);

            foreach (TemplateMatch m in matches)
            {
                Drawing.Rectangle(data, m.Rectangle, TeamColors[(pokeFoundCounter > TeamColors.Count - 1) ? TeamColors.Count - 1 : pokeFoundCounter++]);
            }
            if (pictureBox1 != null)
            {
                pictureBox1.Height = table.Height;
                pictureBox1.Width  = table.Width;
                pictureBox1.Image  = table;
            }
            table.UnlockBits(data);

            return(result);
        }
    private void OnTriggerEnter(Collider other)
    {
        HandState hand = other.gameObject.GetComponent <HandState>();
        Poke      poke = other.gameObject.GetComponent <Poke>();

        if ((hand != null || poke != null) && !pressed)
        {
            switch (type)
            {
            case Type.Next:
                screen.Next();
                break;

            case Type.Back:
                screen.Back();
                break;

            default: break;
            }

            pressed = true;
        }
    }
Example #28
0
        static void Main(string[] args)
        {
            Poke charmander = new Poke()
            {
                HP_Base             = 39,
                Attack_Base         = 52,
                Defence_Base        = 43,
                SpecialAttack_Base  = 60,
                SpecialDefence_Base = 50,
                Speed_Base          = 65,
                Naam       = "Charmander",
                Type       = "Fire",
                NummerPoke = 004
            };

            charmander.ToonInfo();
            Poke bulbasaur = new Poke()
            {
                HP_Base             = 45,
                Attack_Base         = 49,
                Defence_Base        = 49,
                SpecialAttack_Base  = 65,
                SpecialDefence_Base = 65,
                Speed_Base          = 45,
            };

            Poke apoke = new Poke();

            Console.Write($"Geef mij hp: ");
            apoke.HP_Base = Convert.ToInt32(Console.ReadLine());
            Console.Write($"Geef mij attack: ");
            apoke.Attack_Base = Convert.ToInt32(Console.ReadLine());
            Console.Write($"Geef mij defence: ");
            apoke.Defence_Base = Convert.ToInt32(Console.ReadLine());
            Console.Write($"Geef mij specialAttack: ");
            apoke.SpecialAttack_Base = Convert.ToInt32(Console.ReadLine());
            Console.Write($"Geef mij specialDefence: ");
            apoke.SpecialDefence_Base = Convert.ToInt32(Console.ReadLine());
            Console.Write($"Geef mij speed: ");
            apoke.Speed_Base = Convert.ToInt32(Console.ReadLine());
            apoke.VerhoogLevel(5);
            apoke.ToonInfo();

            // random pokemon generen

            Poke newpokemon      = Poke.GeneratorPokemon();
            Poke otherNewPokemon = Poke.GeneratorPokemon();

            newpokemon.ToonInfo();
            otherNewPokemon.ToonInfo();

            for (int i = 1; i <= 50; i++)
            {
                int uitkomst = Poke.Battle(newpokemon, otherNewPokemon);
                if (uitkomst == 1)
                {
                    newpokemon.VerhoogLevel();
                    newpokemon.ToonInfo();
                }
                else if (uitkomst == 2)
                {
                    otherNewPokemon.VerhoogLevel();
                    otherNewPokemon.ToonInfo();
                }
                Console.WriteLine($"de winnaar is nummer{uitkomst}");
                Console.ReadKey();
            }
        }
Example #29
0
 public PokeReplyForm(frmMain parent, Poke originalPoke)
 {
     _parentForm   = parent;
     _originalPoke = originalPoke;
     InitializeComponent();
 }