Пример #1
0
 public void TestAsync()
 {
     using (var multi = new Race<string>())
     {
         multi.Execute(_testAsync);
     }
 }
    void LateUpdate()
    {
        if (enabled && Network.isServer)
        {
            var lSceneManager = GameSceneManager.Singleton;

            if (race == Race.eNone && owner)
                race = PlayerInfo.getRace(owner.layer);

            //有race,则只优化敌队的传输
            if (race == Race.ePismire)
                addTo(lSceneManager.getManager(Race.eBee,
                    GameSceneManager.UnitManagerType.heroSpawn).managerRoot);
            else if (race == Race.eBee)
                addTo(lSceneManager.getManager(Race.ePismire,
                    GameSceneManager.UnitManagerType.heroSpawn).managerRoot);
            else
            {
            //将自己增加到英雄的BoundNetworkScope中
                addTo(lSceneManager.getManager(Race.ePismire,
                    GameSceneManager.UnitManagerType.heroSpawn).managerRoot);
                addTo(lSceneManager.getManager(Race.eBee,
                    GameSceneManager.UnitManagerType.heroSpawn).managerRoot);
            }

        }
        enabled = false;
    }
Пример #3
0
        private void EnsureLoaded()
        {
            using (new ReaderLock(_lock))
            {
                if (_loaded) return;

                using (new WriterLock(_lock))
                {
                    if (_loaded) return;

                    if (null == _cache)
                        _cache = new List<Race>();

                    Connection.ExecuteSql(new Query(RACE_SELECT), delegate(SqlDataReader reader)
                    {
                        while (reader.Read())
                        {
                            if (null != _cache.Find(c => reader[0].ToString() == c.Name))
                                return;

                            var newRace = new Race()
                            {
                                Name = reader[0].ToString()
                            };

                            _cache.Add(newRace);
                        }
                    });

                    _loaded = true;
                }
            }
        }
Пример #4
0
        public void GetNextFiishPosition_PlayersExist_ReturnsExpectedFinishPosition()
        {
            var race = new Race();
            race.CreatePlayers(new Character[3] { Character.Mario, Character.Luigi, Character.Peach });

            race.GetNextFinishPosition().Should().Be(1);
        }
Пример #5
0
        public void GetNextFinishPosition_PlayersIsNull_ThrowsArgumentNullException()
        {
            var race = new Race();

            Action action = () => race.GetNextFinishPosition();
            action.ShouldThrow<ArgumentException>().And.Message.Contains("No Players created");
        }
Пример #6
0
        private IEnumerable<RaceControl<string>> _testSimple(Race<string> race)
        {
            Console.WriteLine("operation called on thread {0}, name '{1}'", Thread.CurrentThread.ManagedThreadId,
                              Thread.CurrentThread.Name);
            int nId = Thread.CurrentThread.ManagedThreadId;

            yield return race.RunAs("x");
            Console.WriteLine("Should be in x");
            Console.WriteLine("operation called on thread {0}, name '{1}'", Thread.CurrentThread.ManagedThreadId,
                              Thread.CurrentThread.Name);

            int xId = Thread.CurrentThread.ManagedThreadId;
            Assert.AreNotEqual(nId, xId);

            yield return race.RunAs("y");
            Console.WriteLine("Should be in y");
            Console.WriteLine("operation called on thread {0}, name '{1}'", Thread.CurrentThread.ManagedThreadId,
                              Thread.CurrentThread.Name);

            int yId = Thread.CurrentThread.ManagedThreadId;
            Assert.AreNotEqual(nId, yId);
            Assert.AreNotEqual(xId, nId);

            yield return race.RunAs("x");
            Console.WriteLine("Should be in x again");
            Console.WriteLine("operation called on thread {0}, name '{1}'", Thread.CurrentThread.ManagedThreadId,
                              Thread.CurrentThread.Name);
            Assert.AreEqual(Thread.CurrentThread.ManagedThreadId, xId);
        }
Пример #7
0
        public void Create_World_And_Hexes()
        {
            var race = new Race { Name = "Default Race" };
            var nation = new Nation { Name = "Default Nation", Race = race };
            var user = new User { Email = "*****@*****.**", FirstName = "Jamie", LastName = "Fraser", OpenId = "http://jamief00.myopenid.com/" };
            var world = new World { Height = 100, Width = 100, Name = "Default World" };
            var game = new Game { Name = "Default Game", Started = DateTime.Now, GameWorld = world};
            var gameSession = new GameSession { EnteredGame = DateTime.Now, Nation = nation, Game = game, User = user };

            using (var tran = _dataContext.WorldRepository.Session.BeginTransaction())
            {
                _dataContext.RaceRepository.Save(race);
                _dataContext.NationRepository.Save(nation);
                _dataContext.UserRepository.Save(user);
                _dataContext.GameRepository.Save(game);
                _dataContext.WorldRepository.Save(world);
                _dataContext.GameSessionRepository.Save(gameSession);

                for (var y = 1; y <= world.Width; y++)
                {
                    for (var x = 1; x <= world.Height; x++)
                    {
                        var hex = new Hex { World = world, HexType = HexType.Grass, X = x, Y = y };

                        _dataContext.HexRepository.Save(hex);
                    }
                }

                tran.Commit();
            }
        }
Пример #8
0
      private void StartNewCampaign(Race setRace)
      {
         Campaign campaign = new Campaign(setRace);
         campaign.StartNew();

         MainGame.WinWarGame.SetNextGameScreen(new LevelGameScreen(campaign));
      }
Пример #9
0
    public Character(Class cClass, Race cRace)
    {
        GameState.Instance.Character = this;
        //Assign character race + class
        charClass = cClass;
        charRace = cRace;

        //Create the player object
        this.Player = (GameObject)GameObject.Instantiate(Resources.Load("Player"));
        //Create the camera object
        this.camera = (GameObject)GameObject.Instantiate(Resources.Load("Camera"));
        //Create minimap camera object
        this.miniMap = (GameObject)GameObject.Instantiate(Resources.Load("MiniMapCam"));

        Cam cam = this.camera.AddComponent<Cam>();
        cam.target = this.Player;

        Cam camMini = this.miniMap.AddComponent<Cam>();
        camMini.target = this.Player;

        Health = MaxHealth;

        UIMain.SetCharLevel();
        UIMain.SetExp();
        UIMain.SetHealth();
        UIMain.SetLevel();
        UIMain.SetCharLevel();

        this.CharClass.Init();
    }
Пример #10
0
 private RaceAnalyzer(Race race)
 {
     _race = race;
     _analyzers.Add(new HeaderAnalyst() {Race = race});
     _analyzers.Add(new FirstTimesAnalyst() { Race = race });
     _analyzers.Add(new LayoffAnalyst() { Race = race });
 }
        public CharacterCreateMenu(WSOGame theGame, Client theClient)
        {
            myGame = theGame;
            netClient = theClient;

            characterRace = Race.Human;
            hairStyleID = 0;
            hairColorID = 0;
            faceStyleID = 0;
            shirtStyleID = 0;
            shirtColorID = 0;
            legsStyleID = 0;
            legsColorID = 0;
            skinColorID = 0;

            spr_HeadSprite = myGame.graphicsManager.Heads[(byte)characterRace][hairStyleID];
            spr_TorsoSprite = myGame.graphicsManager.Torsos[(byte)characterRace][shirtStyleID];
            spr_LegsSprite = myGame.graphicsManager.Legs[(byte)characterRace][legsStyleID];
            spr_FootSprite = myGame.graphicsManager.Feet[(byte)characterRace][legsStyleID];
            spr_ArmsSprite = myGame.graphicsManager.Arms[(byte)characterRace][shirtStyleID];

            spr_Shadow = myGame.graphicsManager.Shadow;

            characterPosition = new Vector2(520, 431);

            characterSlot = 0;
        }
Пример #12
0
        /// <summary>
        /// Base deserialization constructor.
        /// </summary>
        /// <param name="src"></param>
        internal Item(MarketGroup group, SerializableItem src)
            : this(src.ID, src.Name)
        {
            m_marketGroup = group;

            m_icon = src.Icon;
            m_race = src.Race;
            m_slot = src.Slot;
            m_family = src.Family;
            m_description = src.Description;

            m_metaLevel = src.MetaLevel;
            m_metaGroup = src.MetaGroup;

            m_reprocessing = new FastList<Material>(0);
            m_properties = new PropertiesCollection(src.Properties);

            // Skills prerequisites
            m_prerequisites = new FastList<StaticSkillLevel>((src.Prereqs != null ? src.Prereqs.Length : 0));
            if (src.Prereqs == null)
                return;

            foreach (var prereq in src.Prereqs)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level));
            }
        }
Пример #13
0
        internal IngameMenuWindow(Race setRace)
        {
            curRace = setRace;
             LevelGameScreen.Game.GamePaused = true;

             BackgroundColor = new Microsoft.Xna.Framework.Color (0.3f, 0.0f, 0.0f, 0.5f);

             //Width = background.Width;
             //Height = background.Height;

             UIResource res = WarFile.GetUIResource(setRace == Race.Humans ? 368 : 369);

             background = new UIImage(WWTexture.FromImageResource(WarFile.GetImageResource(res.BackgroundImageResourceIndex)));
             background.InitWithUIResource (res);
             AddComponent (background);

             background.X = 120;
             background.Y = 20;

             continueButton = (UIButton)background.Components [6];
             continueButton.OnMouseUpInside += closeButton_OnMouseUpInside;

             quitButton = (UIButton)background.Components [5];
             quitButton.OnMouseUpInside += quitButton_OnMouseUpInside;

             MouseCursor.State = MouseCursorState.Pointer;
        }
        public void Apply(Race race)
        {
            race.Horses.ForEach(horse => horse.NeuralNetworkOpinion = NeuralNetworkOpinion.NoOpinion);

            var map = new Dictionary<Horse, StarterInfo>();
            List<StarterInfo> starterInfoCollection = race.Horses.Select(horse => CreateStarterInfo(horse, map)).Where(si => null != si).ToList();

            int numberOfHorses = race.Horses.Count(h => h.Scratched == false);

            if (starterInfoCollection.Count <= (numberOfHorses * 0.7))
                return;

            var selections = GetSelections(starterInfoCollection);

            foreach (var horse in map.Keys)
            {
                horse.Votes = map[horse].Votes;
                if (null != selections.Find(si=>si==map[horse]))
                {
                    horse.NeuralNetworkOpinion = NeuralNetworkOpinion.IsABet;
                }
                else
                {
                    horse.NeuralNetworkOpinion = NeuralNetworkOpinion.NotABet;
                }
            }
        }
Пример #15
0
 public void TestFoo()
 {
     using (var multi = new Race<string>())
     {
         multi.Execute(_testSimple);
     }
 }
Пример #16
0
        /// <summary>
        /// add a new character to this account, if the newly created character abides to some rules
        /// </summary>
        /// <param name="name">name of the character</param>
        /// <param name="level">level of the character</param>
        /// <param name="race">race of the character</param>
        /// <param name="faction">faction of the character</param>
        /// <param name="class">class of the character</param>
        /// <returns>return true if the creation wnet smoothly</returns>
        public bool AddNewCharacter(Guid id, string name, int level, Race race, Faction faction, Class @class)
        {
            var newCharacter = new Character()
            {
                Id = id,
                Name = name,
                Level = level,
                Race = race,
                Faction = faction,
                Class = @class
            };

            if ( CharacterSpecifications.Factions
                            .And(CharacterSpecifications.DruidSpecifications)
                            .And(CharacterSpecifications.BloodElfSpecifications)
                            .IsSatisfiedBy(newCharacter)
                            && AccountSpecifications.DeathKnightSpecifications(newCharacter)
                            .IsSatisfiedBy(this))
            {
                Characters.Add(newCharacter);
                return true;
            }
            else
                return false;
        }
Пример #17
0
 public void TestThreadStatic()
 {
     using (var race = new Race<Formula1Teams>())
     {
         race.Execute(_testThreadStatic);
     }
 }
Пример #18
0
    public void buildRace(Race pRace)
    {
        if (Network.isServer)
        {
            var lViewID = Network.AllocateViewID();
            var lIntRace = (int)pRace;
            StrongholdSetBuilding(lViewID, lIntRace);
            networkView.RPC("StrongholdSetBuilding", RPCMode.Others, lViewID, lIntRace);
            networkView.enabled = false;
            //if (occupied)
            //{
            //    Debug.LogError("buildRace occupied");
            //    return;
            //}
            //strongholdBuilding = zzCreatorUtility
            //    .Instantiate(getBuilding(pRace), transform.position, transform.rotation, 0);
            //sendMessageWhenDie lSendMessageWhenDie
            //    = strongholdBuilding.GetComponent<sendMessageWhenDie>();
            //lSendMessageWhenDie.messageReceiver = gameObject;
            //owner = pRace;

            //if (Network.peerType != NetworkPeerType.Disconnected)
            //    networkView.RPC("RPCBuildRace", RPCMode.Others,
            //        strongholdBuilding.networkView.viewID, (int)owner);
            //networkView.enabled = false;
            //occupiedEvent();
            //raceChangedEvent(pRace);
        }
        else if (Network.peerType== NetworkPeerType.Disconnected)
        {
            setBuilding((GameObject)Instantiate(getBuilding(pRace)), pRace);
        }
    }
Пример #19
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="X">X on game</param>
 /// <param name="Y">Y on game</param>
 /// <param name="parTexture">Texture</param>
 /// <param name="parRace">Race</param>
 public Monk(int X, int Y, Texture2D parTexture, Race parRace)
     : base(X, Y, parTexture, parRace, Class.Monk)
 {
     ResistPhysical += 50;
     ResistMagic += 50;
     DamageBonus -= 50;
 }
Пример #20
0
        public Player(string name, int level, int exp, int ac, int life, int maxLife, 
            int str, int dex, int con, int intel, 
            int wis, int cha, Race characterRace, Class characterClass, int gold, 
            Weapon equippedWeapon, Spells equippedSpell, Item slot1, Item slot2)
        {
            Random rand = new Random();

            Name = name;
            Level = level;
            Exp = exp;
            AC = ac;
            MaxLife = maxLife;
            Life = life;
            Str = str;
            Dex = dex;
            Con = con;
            Intel = intel;
            Wis = wis;
            Cha = cha;
            Gold = gold;
            CharacterClass = characterClass;
            CharacterRace = characterRace;
            EquippedWeapon = equippedWeapon;
            EquippedSpell = equippedSpell;
            Slot1 = slot1;
            Slot2 = slot2;
        }
    public void showRace(Race race)
    {
        if (nowRace == race)
            return;
        nowRace = race;
        nowValueShow = null;
        if (race == Race.ePismire )
        {
            pismireValueShow.gameObject.SetActiveRecursively(true);
            nowValueShow = pismireValueShow;
        }
        else
        {
            pismireValueShow.gameObject.SetActiveRecursively( false );

        }

        if(race == Race.eBee)
        {
            beeValueShow.gameObject.SetActiveRecursively( true);
            nowValueShow = beeValueShow;
        }
        else
        {
            beeValueShow.gameObject.SetActiveRecursively(false);

        }
    }
Пример #22
0
        private void CreateGraph(Race race)
        {
            _graph.Clear();
            _races.Clear();

            foreach (var horse in race.Horses)
            {
                if(horse.Scratched)
                    continue;

                foreach (var pp in horse.CorrespondingBrisHorse.PastPerformances)
                {
                    AddRaceInfoToGraph(horse, GetRaceInfo(pp));
                }
            }

            _races.ForEach(r=>r.Matches=0);

            foreach (var horse in _graph.Keys)
            {
                foreach (var ri in _graph[horse])
                {
                    ++ri.Matches;
                }
            }
        }
Пример #23
0
 public Variable(string name, 
             string fullName, 
             int length,
             int height,
             int gapTop,
             int gapRight,
             int gapBottom,
             int gapLeft,
             Race race,
             int treedepth,
             int value = -1)
     : this(name,
       fullName,
       new ghost.Domain( -1 ),
       length,
       height,
       gapTop,
       gapRight,
       gapBottom,
       gapLeft,
       race,
       treedepth,
       value)
 {
 }
Пример #24
0
        public Player createPlayer(Race race, String name, List<Unit> units)
        {
            Player p =  new PlayerImpl(race, name, units);
            p.points = new List<Position>();
            return p;

        }
Пример #25
0
        private async Task LoadPlayer(int guid)
        {
            var stmt = ServerManager.charDB.GetPreparedStatement(CharDatabase.CharDatabaseStatements.CHAR_SEL_CHARACTER);
            stmt.Parameters["@guid"].Value =  guid;
            var dt = await stmt.Execute(false);

            if (dt.Rows.Count == 0)
            {
                Logger.LOG_DATABASE.Error("Player with GUID " + guid.ToString() + " not found in table `characters`, can't load.");
                return;
            }

            if (XConverter.ToInt32(dt.Rows[0][0]) != guid)
            {
                Logger.LOG_DATABASE.Error("Error during loading player with GUID " + guid.ToString() + ".");
                return;
            }

            this.guid = XConverter.ToUInt32(dt.Rows[0][0]);
            this.acccountId = XConverter.ToUInt32(dt.Rows[0][1]);
            this.name = dt.Rows[0][2].ToString();
            this.race = (Race)Enum.ToObject(typeof(Race), XConverter.ToInt32(dt.Rows[0][3]));
            this._class = (Class)Enum.ToObject(typeof(Class), dt.Rows[0][4]);
            this.gender = (Gender)Enum.ToObject(typeof(Gender), dt.Rows[0][5]);
            this.money = XConverter.ToInt32(dt.Rows[0][8]);
        }
Пример #26
0
 public PlayerImpl(string pseudo,Race r)
 {
     Pseudo = pseudo;
     race = r;
     isTurn = false;
     pawns = new List<Pawn>();
 }
Пример #27
0
 public int AddNewRace(Race r)
 {
     var db = new Database();
     db.Races.InsertOnSubmit(r);
     db.SubmitChanges();
     int id = r.Id;
     return id;
 }
Пример #28
0
        public int SolutionPart2(int raceDuration, params string[] input)
        {
            var racers = CreateRacersFromInput(input);

            var race = new Race(raceDuration, racers);

            return race.GetWinningScore();
        }
Пример #29
0
        public RaceReturnModel Create(Race race)
        {
            if (race == null) throw new ArgumentNullException(nameof(race));

            var model = Mapper.Map<RaceReturnModel>(race);
            model.Url = _urlHelper.Link("GetRaceById", new {id = race.Id});
            return model;
        }
Пример #30
0
 public RaceFinishedScreen(Race race, Track raceTrack)
     : base()
 {
     _race = race;
     _raceTrack = raceTrack;
     _background = ScreenEffects.TakeScreenshot();
     GC.Collect(); //force some memory freeness here.
 }
Пример #31
0
        private void BtnUpdate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (cboAttribute.SelectedIndex > -1)
                {
                    if (ScreenMode.Location == screenmode)
                    {
                        Location location = new Location();
                        location = locations[cboAttribute.SelectedIndex];

                        if (!string.IsNullOrEmpty(txtDescription.Text))
                        {
                            location.Description = txtDescription.Text;
                        }
                        else
                        {
                            throw new Exception("Please enter a location");
                        }

                        /*
                         * var locationMatches = locations.Select(l => l.Description).Where(l => l == txtDescription.Text);
                         * int locationMatchCount = locationMatches.Count();
                         * if (locationMatchCount > 0)
                         * {
                         *  if (locations[cboAttribute.SelectedIndex].Description == txtDescription.Text && locationMatchCount == 1)
                         *  {
                         *      location.Description = txtDescription.Text;
                         *  }
                         *  else
                         *  {
                         *      throw new Exception("This location has already exists.");
                         *  }
                         * }
                         */

                        //Send it to the API
                        HttpClient client             = InitializeClient();
                        string     serializedLocation = JsonConvert.SerializeObject(location);
                        var        content            = new StringContent(serializedLocation);
                        content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
                        HttpResponseMessage response = client.PutAsync("Location/" + location.Id, content).Result;

                        if (response.StatusCode == System.Net.HttpStatusCode.OK || response.StatusCode == System.Net.HttpStatusCode.NoContent)
                        {
                            // Save index, refresh screen, and reselect where we are.
                            var index = cboAttribute.SelectedIndex;
                            Rebind();
                            cboAttribute.SelectedIndex = index;
                        }
                        else
                        {
                            throw new Exception("Location could not be updated");
                        }
                    }
                    else if (ScreenMode.Gender == screenmode)
                    {
                        Gender gender = new Gender();
                        gender = genders[cboAttribute.SelectedIndex];

                        if (!string.IsNullOrEmpty(txtDescription.Text))
                        {
                            gender.Description = txtDescription.Text;
                        }
                        else
                        {
                            throw new Exception("Please enter a gender");
                        }



                        /*
                         * var genderMatches = genders.Select(l => l.Description).Where(l => l == txtDescription.Text);
                         * int genderMatchCount = genderMatches.Count();
                         * if (genderMatchCount > 0)
                         * {
                         *  if (genders[cboAttribute.SelectedIndex].Description == txtDescription.Text && genderMatchCount == 1)
                         *  {
                         *      gender.Description = txtDescription.Text;
                         *  }
                         *  else
                         *  {
                         *      throw new Exception("This gender has already exists.");
                         *  }
                         * }
                         */

                        //Send it to the API
                        HttpClient client           = InitializeClient();
                        string     serializedGender = JsonConvert.SerializeObject(gender);
                        var        content          = new StringContent(serializedGender);
                        content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
                        HttpResponseMessage response = client.PutAsync("Gender/" + gender.Id, content).Result;

                        if (response.StatusCode == System.Net.HttpStatusCode.OK || response.StatusCode == System.Net.HttpStatusCode.NoContent)
                        {
                            // Save index, refresh screen, and reselect where we are.
                            var index = cboAttribute.SelectedIndex;
                            Rebind();
                            cboAttribute.SelectedIndex = index;
                        }
                        else
                        {
                            throw new Exception("Gender could not be updated");
                        }
                    }
                    else if (ScreenMode.Race == screenmode)
                    {
                        Race race = new Race();
                        race = races[cboAttribute.SelectedIndex];

                        if (!string.IsNullOrEmpty(txtDescription.Text))
                        {
                            race.Description = txtDescription.Text;
                        }
                        else
                        {
                            throw new Exception("Please enter a race");
                        }

                        /*
                         * var raceMatches = races.Select(l => l.Description).Where(l => l == txtDescription.Text);
                         * int raceMatchCount = raceMatches.Count();
                         * if (raceMatchCount > 0)
                         * {
                         *  if (races[cboAttribute.SelectedIndex].Description == txtDescription.Text && raceMatchCount == 1)
                         *  {
                         *      race.Description = txtDescription.Text;
                         *  }
                         *  else
                         *  {
                         *      throw new Exception("This race has already exists.");
                         *  }
                         * }
                         */

                        //Send it to the API
                        HttpClient client         = InitializeClient();
                        string     serializedRace = JsonConvert.SerializeObject(race);
                        var        content        = new StringContent(serializedRace);
                        content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
                        HttpResponseMessage response = client.PutAsync("Race/" + race.Id, content).Result;

                        if (response.StatusCode == System.Net.HttpStatusCode.OK || response.StatusCode == System.Net.HttpStatusCode.NoContent)
                        {
                            // Save index, refresh screen, and reselect where we are.
                            var index = cboAttribute.SelectedIndex;
                            Rebind();
                            cboAttribute.SelectedIndex = index;
                        }
                        else
                        {
                            throw new Exception("Race could not be updated");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error!");
            }
        }
Пример #32
0
        private void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (cboAttribute.SelectedIndex > -1)
                {
                    if (ScreenMode.Location == screenmode)
                    {
                        if (cboAttribute.SelectedItem != null)
                        {
                            //Call the API if the selected item isn't null to delete it
                            HttpClient          client   = InitializeClient();
                            HttpResponseMessage response = new HttpResponseMessage();

                            Location location = locations.ElementAt(cboAttribute.SelectedIndex);

                            response = client.DeleteAsync("Location/" + location.Id).Result;
                            locations.Remove(location);

                            Rebind();

                            txtDescription.Focus();
                            txtDescription.SelectAll();
                        }
                    }
                    else if (ScreenMode.Gender == screenmode)
                    {
                        if (cboAttribute.SelectedItem != null)
                        {
                            //Call the API if the selected item isn't null to delete it
                            HttpClient          client   = InitializeClient();
                            HttpResponseMessage response = new HttpResponseMessage();

                            Gender gender = genders.ElementAt(cboAttribute.SelectedIndex);

                            response = client.DeleteAsync("Gender/" + gender.Id).Result;
                            genders.Remove(gender);

                            Rebind();

                            txtDescription.Focus();
                            txtDescription.SelectAll();
                        }
                    }
                    else if (ScreenMode.Race == screenmode)
                    {
                        if (cboAttribute.SelectedItem != null)
                        {
                            //Call the API if the selected item isn't null to delete it
                            HttpClient          client   = InitializeClient();
                            HttpResponseMessage response = new HttpResponseMessage();

                            Race race = races.ElementAt(cboAttribute.SelectedIndex);

                            response = client.DeleteAsync("Race/" + race.Id).Result;
                            races.Remove(race);

                            Rebind();

                            txtDescription.Focus();
                            txtDescription.SelectAll();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error!");
            }
        }
        private void UpdateCharacterWindow()
        {
            Race aRace = PlayerData.GetRace();

            if (myBodyGroup != null)
            {
                SetBodyStyle(-1, null);
                myBodyGroup.clearChildren();
            }
            if (aHairGroup != null)
            {
                SetHairStyle(-1, null);
                aHairGroup.clearChildren();
            }
            if (aRace == null)
            {
                return;
            }
            if (PlayerData?.Sex == GameData.GameDataClasses.Entities.SEX.MALE)
            {
                List <CheckBox> Bodyboxes = new List <CheckBox>();
                List <CheckBox> Hairboxes = new List <CheckBox>();
                for (int i = 0; i < aRace.MaleBodies.Length; i++)
                {
                    var ChekboxOnTexture   = new SubtextureDrawable(aRace.MaleBodies[i]);
                    var CheckboxOffTexture = new SubtextureDrawable(aRace.MaleBodies[i]);
                    CheckboxOffTexture.tintColor = new Color(0, 0, 0, 100);
                    CheckBox myNewButton = new CheckBox("", new CheckBoxStyle(ChekboxOnTexture, CheckboxOffTexture, Nez.Core.content.Load <BitmapFont>("Fonts/NezDefaultBMFont"), Color.White));

                    int g = i;
                    myNewButton.onChanged += delegate(bool value)
                    {
                        int             x                 = g;
                        CheckBox        aNewButton        = myNewButton;
                        Texture2D       Aval              = aRace.MaleBodies[x];
                        List <CheckBox> internalHairboxes = Bodyboxes;
                        if (value)
                        {
                            foreach (CheckBox B in internalHairboxes)
                            {
                                if (B != aNewButton)
                                {
                                    B.isChecked = false;
                                }
                            }
                            SetBodyStyle(x, Aval);
                        }
                        else
                        {
                            SetBodyStyle(-1, null);
                        }
                        canMoveOn();
                    };
                    myBodyGroup.addElement(myNewButton);
                }
                for (int i = 0; i < aRace.Hairstyles.Length; i++)
                {
                    var ChekboxOnTexture   = new SubtextureDrawable(aRace.Hairstyles[i]);
                    var CheckboxOffTexture = new SubtextureDrawable(aRace.Hairstyles[i]);
                    CheckboxOffTexture.tintColor = new Color(0, 0, 0, 100);
                    CheckBox myNewButton = new CheckBox("", new CheckBoxStyle(ChekboxOnTexture, CheckboxOffTexture, Nez.Core.content.Load <BitmapFont>("Fonts/NezDefaultBMFont"), Color.White));
                    aHairGroup.addElement(myNewButton);
                    Hairboxes.Add(myNewButton);
                    int g = i;
                    myNewButton.onChanged += delegate(bool value)
                    {
                        int             x                 = g;
                        CheckBox        aNewButton        = myNewButton;
                        Texture2D       Aval              = aRace.Hairstyles[x];
                        List <CheckBox> internalHairboxes = Hairboxes;
                        if (value)
                        {
                            foreach (CheckBox B in internalHairboxes)
                            {
                                if (B != aNewButton)
                                {
                                    B.isChecked = false;
                                }
                            }
                            SetHairStyle(x, Aval);
                        }
                        else
                        {
                            SetHairStyle(-1, null);
                        }
                        canMoveOn();
                    };
                }
            }
            else if (PlayerData?.Sex == GameData.GameDataClasses.Entities.SEX.FEMALE)
            {
                List <CheckBox> Bodyboxes = new List <CheckBox>();
                for (int i = 0; i < aRace.FemaleBodies.Length; i++)
                {
                    var ChekboxOnTexture   = new SubtextureDrawable(aRace.FemaleBodies[i]);
                    var CheckboxOffTexture = new SubtextureDrawable(aRace.FemaleBodies[i]);
                    CheckboxOffTexture.tintColor = new Color(0, 0, 0, 100);
                    CheckBox myNewButton = new CheckBox("", new CheckBoxStyle(ChekboxOnTexture, CheckboxOffTexture, Nez.Core.content.Load <BitmapFont>("Fonts/NezDefaultBMFont"), Color.White));
                    Bodyboxes.Add(myNewButton);
                    int g = i;
                    myNewButton.onChanged += delegate(bool value)
                    {
                        int             x                 = g;
                        CheckBox        aNewButton        = myNewButton;
                        Texture2D       Aval              = aRace.FemaleBodies[x];
                        List <CheckBox> internalHairboxes = Bodyboxes;
                        if (value)
                        {
                            foreach (CheckBox B in internalHairboxes)
                            {
                                if (B != aNewButton)
                                {
                                    B.isChecked = false;
                                }
                            }
                            SetBodyStyle(x, aRace.FemaleBodies[x]);
                        }
                        else
                        {
                            SetBodyStyle(-1, null);
                        }
                        canMoveOn();
                    };

                    myBodyGroup.addElement(myNewButton);
                }
                List <CheckBox> Hairboxes = new List <CheckBox>();
                for (int i = 0; i < aRace.Hairstyles.Length; i++)
                {
                    var ChekboxOnTexture   = new SubtextureDrawable(aRace.Hairstyles[i]);
                    var CheckboxOffTexture = new SubtextureDrawable(aRace.Hairstyles[i]);
                    CheckboxOffTexture.tintColor = new Color(0, 0, 0, 100);
                    CheckBox myNewButton = new CheckBox("", new CheckBoxStyle(ChekboxOnTexture, CheckboxOffTexture, Nez.Core.content.Load <BitmapFont>("Fonts/NezDefaultBMFont"), Color.White));
                    Hairboxes.Add(myNewButton);
                    int g = i;
                    myNewButton.onChanged += delegate(bool value)
                    {
                        int             x                 = g;
                        CheckBox        aNewButton        = myNewButton;
                        Texture2D       Aval              = aRace.Hairstyles[x];
                        List <CheckBox> internalHairboxes = Hairboxes;
                        if (value)
                        {
                            foreach (CheckBox B in internalHairboxes)
                            {
                                if (B != aNewButton)
                                {
                                    B.isChecked = false;
                                }
                            }
                            SetHairStyle(x, Aval);
                        }
                        else
                        {
                            SetHairStyle(-1, null);
                        }
                        canMoveOn();
                    };
                    aHairGroup.addElement(myNewButton);
                }
            }
        }
Пример #34
0
 public RaceChangeState(IRaceChanger owner, NetState ns, Race targetRace)
 {
     m_Owner      = owner;
     m_TargetRace = targetRace;
     m_Timeout    = Timer.DelayCall <NetState>(m_TimeoutDelay, m_TimeoutCallback, ns);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:StatusQuoBaseball.Loaders.PersonBasicInformation"/> struct.
 /// </summary>
 /// <param name="id">Identifier.</param>
 /// <param name="lName">L name.</param>
 /// <param name="fName">F name.</param>
 /// <param name="number">Number.</param>
 /// <param name="naturalPosition">Natural position.</param>
 /// <param name="race">Race.</param>
 /// <param name="handedness">Handedness.</param>
 /// <param name="bats">Bats.</param>
 /// <param name="height">Height.</param>
 /// <param name="weight">Weight.</param>
 /// <param name="birthday">Birthday</param>
 /// <param name="deathday">Deathday</param>
 public PersonBasicInformation(string id, string lName, string fName, string number, string naturalPosition, Race race, Handedness handedness, Handedness bats, Height height, Weight weight, Birthday birthday, Deathday deathday)
 {
     this.id              = id;
     this.lName           = lName;
     this.fName           = fName;
     this.number          = number;
     this.naturalPosition = naturalPosition;
     this.race            = race;
     this.handedness      = handedness;
     this.bats            = bats;
     this.height          = height;
     this.weight          = weight;
     this.birthday        = birthday;
     this.deathday        = deathday;
 }
Пример #36
0
 public static SelfCondition IsControllingRace(Race race) => new SelfCondition(me => me.Controller.BoardZone.Any(p => p.Card.Race == race));
        public async Task PlayerHeroStats_PlayerAgainstEnemyAndPlayerLosses_EnemyShouldHaveCorrectHeroStats(Race enemyRace)
        {
            var playerRepository       = new PlayerStatsRepository(MongoClient);
            var playerHeroStatsHandler = new PlayerHeroStatsHandler(playerRepository);

            var player       = CreatePlayer("player#123", Race.HU, won: false);
            var playerHeroes = CreateHeroes("playerhero");

            var enemyPlayer   = CreatePlayer("enemy#567", enemyRace, won: true);
            var enemyUdHeroes = CreateHeroes("enemyhero");

            MatchFinishedEvent match1 = CreateMatchEvent(player, playerHeroes, enemyPlayer, enemyUdHeroes);
            await playerHeroStatsHandler.Update(match1);

            var enemyHerosStats = await playerRepository.LoadHeroStat(enemyPlayer.battleTag, 0);

            Assert.AreEqual(enemyPlayer.battleTag, enemyHerosStats.BattleTag);
            Assert.AreEqual(1, enemyHerosStats.HeroStatsItemList.Count);

            var enemyHeroStats = GetHeroStatsForRaceAndMap(enemyHerosStats, "enemyhero", enemyRace, "Overall");

            var enemyStatsVsPlayerRace = enemyHeroStats.WinLosses.Single(x => x.Race == Race.HU);

            Assert.AreEqual(1, enemyStatsVsPlayerRace.Wins);
            Assert.AreEqual(0, enemyStatsVsPlayerRace.Losses);
        }
Пример #38
0
        public AC(string _name, Job _job, Race _race)
        {
            name  = _name;
            job   = _job;
            race  = _race;
            level = 1;

            Random     r     = new Random();
            List <int> stats = new List <int>();

            for (int i = 0; i < 3; i++)
            {
                //rolls.Clear();
                List <int> rolls   = new List <int>();
                int        teemp   = 10;
                int        tempInd = 0;
                for (int j = 0; j < 4; j++)
                {
                    rolls.Add(r.Next(1, 7));
                    if (rolls[j] < teemp)
                    {
                        tempInd = j;
                        teemp   = rolls[j];
                    }
                }
                rolls.RemoveAt(tempInd);
                stats.Add(rolls[0] + rolls[1] + rolls[2]);
            }

            List <int> orderedStats = new List <int>();
            int        teeemp       = 0;
            int        teeempInd    = 0;

            for (int i = 0; i < 3; i++)
            {
                if (stats[i] > teeemp)
                {
                    teeemp = stats[i]; teeempInd = i;
                }
            }
            orderedStats.Add(stats[teeempInd]);
            stats.RemoveAt(teeempInd);
            if (stats[0] > stats[1])
            {
                orderedStats.Add(stats[0]);
                orderedStats.Add(stats[1]);
            }
            else
            {
                orderedStats.Add(stats[1]); orderedStats.Add(stats[0]);
            }


            switch (race)
            {
            case Race.Human:
                Physical++;
                Subterfuge++;
                Knowledge++;
                Communication++;
                break;

            case Race.Elf:
                mind += 2;
                break;

            case Race.Dwarf:
                str += 2;
                break;

            case Race.Halfling:
                dex += 2;
                break;
            }
            switch (job)
            {
            case Job.Warrior:
                Physical += 3;
                str      += orderedStats[0];
                dex      += orderedStats[1];
                mind     += orderedStats[2];

                weapon      = new Weapon(Weapon.WeaponType.SpikedChain);
                armorSet[1] = new Armor(Armor.ArmorType.Leather);

                break;

            case Job.Rogue:
                Subterfuge += 3;
                dex        += orderedStats[0];
                mind       += orderedStats[1];
                str        += orderedStats[2];

                weapon = new Weapon(Weapon.WeaponType.HandCrossbow);
                break;


            case Job.Mage:
                Knowledge += 3;
                mind      += orderedStats[0];
                dex       += orderedStats[1];
                str       += orderedStats[2];

                break;

            case Job.Cleric:
                Communication += 3;
                str           += orderedStats[0];
                mind          += orderedStats[1];
                dex           += orderedStats[2];

                break;
            }


            initHP();
        }
Пример #39
0
 public override string ToString()
 {
     return(Race.ToString()[0] + " " + GetCoords() + " hp=" + HitPoints);
 }
Пример #40
0
        public List <Character> LoadCharacters()
        {
            string query = "SELECT * FROM character";

            using (connection = new SqlConnection(ConnectionString))
                using (SqlCommand command = new SqlCommand(query, connection))
                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        DataTable characterTable = new DataTable();
                        adapter.Fill(characterTable);

                        List <Character> characters = new List <Character>();

                        foreach (DataRow row in characterTable.Rows)
                        {
                            int       characterId            = row.Field <int>("Id");
                            string    name                   = row.Field <string>("Name");
                            ClassType characterClass         = (ClassType)row.Field <int>("Class");
                            Race      characterRace          = (Race)row.Field <int>("Race");
                            Dictionary <Attribute, int> dict = new Dictionary <Attribute, int>();
                            dict.Add(Attribute.Strength, row.Field <int>("Strength"));
                            dict.Add(Attribute.Dexterity, row.Field <int>("Dexterity"));
                            dict.Add(Attribute.Intelligence, row.Field <int>("Intelligence"));
                            dict.Add(Attribute.Wisdom, row.Field <int>("Wisdom"));
                            dict.Add(Attribute.Constitution, row.Field <int>("Constitution"));
                            dict.Add(Attribute.Charisma, row.Field <int>("Charisma"));
                            int HitPoints           = row.Field <int>("HitPoints");
                            int xp                  = row.Field <int>("XP");
                            int equippedToBody      = row.Field <int>("EquippedToBody");
                            int equippedToRightHand = row.Field <int>("EquippedToRightHand");
                            int equippedToLeftHand  = row.Field <int>("EquippedToLeftHand");

                            EquipmentItems bodyEquipment      = null;
                            EquipmentItems rightHandEquipment = null;
                            EquipmentItems leftHandEquipment  = null;

                            if (equippedToBody != 0)
                            {
                                bodyEquipment = LoadEquipment(equippedToBody);
                            }

                            if (equippedToRightHand != 0)
                            {
                                rightHandEquipment = LoadEquipment(equippedToRightHand);
                            }

                            if (equippedToLeftHand != 0)
                            {
                                leftHandEquipment = LoadEquipment(equippedToLeftHand);
                            }

                            Character character = null;

                            switch (characterClass)
                            {
                            case ClassType.Fighter:
                            {
                                character = new Fighter(name, characterRace, dict, HitPoints, xp);
                                break;
                            }

                            case ClassType.Thief:
                            {
                                character = new Thief(name, characterRace, dict, HitPoints, xp);
                                break;
                            }

                            case ClassType.MagicUser:
                            {
                                character = new MagicUser(name, characterRace, dict, HitPoints, xp);
                                break;
                            }

                            case ClassType.Cleric:
                            {
                                character = new Cleric(name, characterRace, dict, HitPoints, xp);
                                break;
                            }
                            }

                            if (bodyEquipment != null)
                            {
                                character.EquipToBody(bodyEquipment);
                            }

                            if (rightHandEquipment != null)
                            {
                                character.EquipToHand(rightHandEquipment, Hand.Right);
                            }

                            if (leftHandEquipment != null)
                            {
                                character.EquipToHand(leftHandEquipment, Hand.Left);
                            }

                            character.SetCharacterId(characterId);

                            characters.Add(character);
                        }
                        return(characters);
                    }
        }
Пример #41
0
 public Character(string name, Race race, Gender gender)
 {
     Name   = name;
     Race   = race;
     Gender = gender;
 }
Пример #42
0
        public SerpentsFangAssassin() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
        {
            Name       = "Black Order Assassin";
            Title      = "of the Serpent's Fang Sect";
            Female     = Utility.RandomBool();
            Race       = Race.Human;
            Hue        = Race.RandomSkinHue();
            HairItemID = Race.RandomHair(Female);
            HairHue    = Race.RandomHairHue();
            Race.RandomFacialHair(this);

            AddItem(new ThighBoots(0x51D));
            AddItem(new FancyShirt(0x51D));
            AddItem(new StuddedMempo());
            AddItem(new JinBaori(0x2A));

            Item item;

            item     = new StuddedGloves();
            item.Hue = 0x2A;
            AddItem(item);

            item     = new LeatherNinjaPants();
            item.Hue = 0x51D;
            AddItem(item);

            item     = new LightPlateJingasa();
            item.Hue = 0x51D;
            AddItem(item);

            item     = new Sai();
            item.Hue = 0x51D;
            AddItem(item);



            SetStr(325, 375);
            SetDex(175, 275);
            SetInt(85, 105);

            SetHits(350, 375);

            SetDamage(14, 22);

            SetDamageType(ResistanceType.Physical, 100);

            SetResistance(ResistanceType.Physical, 35, 60);
            SetResistance(ResistanceType.Fire, 45, 65);
            SetResistance(ResistanceType.Cold, 25, 45);
            SetResistance(ResistanceType.Poison, 40, 60);
            SetResistance(ResistanceType.Energy, 40, 65);

            SetSkill(SkillName.MagicResist, 80.0, 100.0);
            SetSkill(SkillName.Tactics, 115.0, 130.0);
            SetSkill(SkillName.Wrestling, 95.0, 120.0);
            SetSkill(SkillName.Anatomy, 105.0, 120.0);
            SetSkill(SkillName.Fencing, 78.0, 100.0);
            SetSkill(SkillName.Swords, 90.1, 105.0);
            SetSkill(SkillName.Ninjitsu, 90.0, 120.0);
            SetSkill(SkillName.Hiding, 100.0, 120.0);
            SetSkill(SkillName.Stealth, 100.0, 120.0);



            Fame  = 5000;
            Karma = -5000;

            VirtualArmor = 58;



            m_DecayTime = DateTime.Now + TimeSpan.FromMinutes(10.0);

            m_Timer = new InternalTimer(this, m_DecayTime);
            m_Timer.Start();
        }
        public override void initialize()
        {
            this.Communication = Nez.Core.services.GetService <CommunicationManager>();
            setDesignResolution(1280, 720, Scene.SceneResolutionPolicy.NoBorderPixelPerfect);
            Screen.setSize(1280, 720);
            var myRenderer = new ScreenSpaceRenderer(100, SCREEN_SPACE_RENDER_LAYER);

            myRenderer.wantsToRenderAfterPostProcessors = false;
            addRenderer(myRenderer);
            var myGUIRenderer = new RenderLayerExcludeRenderer(0, SCREEN_SPACE_RENDER_LAYER);

            addRenderer(myGUIRenderer);
            canvas = createEntity("GUI").addComponent(new UICanvas());
            Texture2D LoginBackground = content.Load <Texture2D>("GUI/Login Elements/LoginBackground");

            //canvas.isFullScreen = true;
            canvas.stage.addElement(new Image(LoginBackground));
            ScrollPaneStyle myScrollStyle = new ScrollPaneStyle();

            myScrollStyle.hScrollKnob = new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Scrollbar/ScrollHandle"));
            myScrollStyle.hScroll     = new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Scrollbar/HScrollBar"));
            Bodies = new ScrollPane(myBodyGroup, myScrollStyle);
            Hair   = new ScrollPane(aHairGroup, myScrollStyle);
            HorizontalGroup myHGroup = new HorizontalGroup();

            myHGroup.setAlignment(Align.left);
            myHGroup.setY(70);
            myHGroup.setSpacing(0);
            VerticalGroup myCharacterDataGroup = new VerticalGroup();

            myCharacterDataGroup.setSpacing(20);
            myCharacterDataGroup.setAlignment(Align.left);
            myCharacterViewerGroup = new VerticalGroup();
            myCharacterViewerGroup.setY(70);
            HorizontalGroup mySexGroup = new HorizontalGroup();

            mySexGroup.setSpacing(10);


            CheckBox Male = new CheckBox("Male", new CheckBoxStyle(new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Checkbox Elements/Checkbox_Unchecked")), new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Checkbox Elements/Checkbox_Checked")), Nez.Core.content.Load <BitmapFont>("Fonts/NezDefaultBMFont"), Color.White));

            myDisplayedHair = new Image();
            myDisplayedBody = new Image();
            myImageStack.addElement(myDisplayedBody);
            myImageStack.addElement(myDisplayedHair);
            var ContainerStack = new Container(myImageStack);

            ContainerStack.setWidth(128);
            ContainerStack.setHeight(128);
            myCharacterViewerGroup.addElement(ContainerStack);

            CharacterCreatorSwitch = new Button(new ButtonStyle(new SubtextureDrawable(Core.content.Load <Texture2D>("GUI/Buttons/savebutton")), new SubtextureDrawable(Core.content.Load <Texture2D>("GUI/Buttons/savebutton")), new SubtextureDrawable(Core.content.Load <Texture2D>("GUI/Buttons/savebutton"))));
            CharacterCreatorSwitch.setTouchable(Touchable.Disabled);
            myCharacterViewerGroup.setAlignment(Align.bottom);
            myCharacterViewerGroup.addElement(Bodies);
            myCharacterViewerGroup.addElement(Hair);
            myCharacterViewerGroup.setPadTop(270);
            CheckBox Female = new CheckBox("Female", new CheckBoxStyle(new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Checkbox Elements/Checkbox_Unchecked")), new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Checkbox Elements/Checkbox_Checked")), Nez.Core.content.Load <BitmapFont>("Fonts/NezDefaultBMFont"), Color.White));

            Male.onChanged += delegate(bool myResult)
            {
                if (myResult)
                {
                    PlayerData.Sex = GameData.GameDataClasses.Entities.SEX.MALE;
                }
                else
                {
                    PlayerData.Sex = null;
                }
                Female.programmaticChangeEvents = false; //Prevents it from firing.
                Female.isChecked = false;
                Female.programmaticChangeEvents = true;
                UpdateCharacterWindow();
            };
            Female.onChanged += delegate(bool myResult)
            {
                if (myResult)
                {
                    PlayerData.Sex = GameData.GameDataClasses.Entities.SEX.FEMALE;
                }
                else
                {
                    PlayerData.Sex = null;
                }
                Male.programmaticChangeEvents = false; //Prevents it from firing.
                Male.isChecked = false;
                Male.programmaticChangeEvents = true;
                UpdateCharacterWindow();
            };

            mySexGroup.addElement(Male);
            mySexGroup.addElement(Female);
            myCharacterDataGroup.addElement(mySexGroup);
            HorizontalGroup myRaceGroupAndDescription = new HorizontalGroup();
            VerticalGroup   myRaceGroup  = new VerticalGroup();
            List <CheckBox> myRaceChecks = new List <CheckBox>();

            foreach (String A in Directory.EnumerateFiles("./Content/Races"))
            {
                String   aRacename   = Path.GetFileNameWithoutExtension(A);
                Race     aLoadedRace = Nez.Core.content.Load <Race>("Races/" + aRacename);
                CheckBox aNewRace    = new CheckBox(aRacename, new CheckBoxStyle(new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Checkbox Elements/Checkbox_Unchecked")), new SubtextureDrawable(Nez.Core.content.Load <Texture2D>("GUI/Checkbox Elements/Checkbox_Checked")), Nez.Core.content.Load <BitmapFont>("Fonts/NezDefaultBMFont"), Color.White));
                myRaceChecks.Add(aNewRace);
                aNewRace.onChanged += delegate(bool myResult)
                {
                    var Racebox = aNewRace;
                    if (myResult)
                    {
                        foreach (CheckBox a in myRaceChecks)
                        {
                            if (Racebox != a)
                            {
                                a.isChecked = false;
                            }
                        }

                        Race myInternalRace = aLoadedRace;
                        SetRace(myInternalRace);
                        UpdateCharacterWindow();
                    }
                    else
                    {
                        SetRace(null);
                        UpdateCharacterWindow();
                    }
                };
                aNewRace.OnMouseOver += delegate(bool myResult)
                {
                    if (myResult)
                    {
                        Race myInternalRace = aLoadedRace;
                        myRaceDescription.setText(myInternalRace.Description);
                        myRaceDescription.setWrap(true);
                    }
                    else
                    {
                        myRaceDescription.setText("");
                    }
                };
                myRaceGroup.addElement(aNewRace);
            }
            myRaceDescription = new Label("Race Description HERE");
            myRaceDescription.setWidth(Screen.width * 0.25f);
            myRaceDescription.setHeight(30);
            myRaceDescription.setWrap(true);
            myRaceGroup.setAlignment(Align.bottomLeft);
            myRaceGroupAndDescription.setSpacing(10);
            myRaceGroupAndDescription.setWidth(100);
            myRaceGroupAndDescription.addElement(myRaceGroup);
            myRaceGroupAndDescription.setAlignment(Align.left);
            Container aRaceDescriptionHolder = new Container();

            aRaceDescriptionHolder.setSize(Screen.width * 0.25f, 30);
            aRaceDescriptionHolder.setY(0);
            aRaceDescriptionHolder.addElement(myRaceDescription);
            myRaceGroupAndDescription.addElement(aRaceDescriptionHolder);
            myCharacterDataGroup.addElement(myRaceGroupAndDescription);
            myHGroup.addElement(myCharacterDataGroup);
            myHGroup.addElement(myCharacterViewerGroup);
            //Professions GUI
            HorizontalGroup myHorizontalProfessions = new HorizontalGroup();
            VerticalGroup   myProfessionsbox        = new VerticalGroup();

            //Iterate professions however we're doing it
            myHorizontalProfessions.addElement(myProfessionsbox);
            VerticalGroup myProfessionsDesc       = new VerticalGroup();
            Label         myProfessionDescription = new Label("Profession Description HERE");

            myProfessionsDesc.addElement(myProfessionDescription);
            Label myProfessionAlert = new Label("Profession Alertbox HERE");

            myProfessionsDesc.addElement(myProfessionAlert);
            myHorizontalProfessions.addElement(myProfessionsDesc);
            myCharacterDataGroup.addElement(myHorizontalProfessions);
            canvas.stage.addElement(myHGroup);
            //myHGroup.add(myInternalHGroup);*/
            base.initialize();
        }
Пример #44
0
 public Variable(string name, ghost.Domain domain, Race race, int value = 0)
     : base(name, name, domain, value)
 {
     Race = race;
 }
Пример #45
0
 private void xhin_Click(object sender, RoutedEventArgs e)
 {
     this.SelectedRace = Game.Races["Xhin"];
     this.SetSelection(xhin);
 }
        private static WinLossesPerMap GetHeroStatsForRaceAndMap(PlayerHeroStats playerHeroStats, string heroId, Race race, string mapName)
        {
            var heroStats          = playerHeroStats.HeroStatsItemList.Single(x => x.HeroId == heroId).Stats;
            var heroRaceStats      = heroStats.Single(x => x.Race == race);
            var heroRaceStatsOnMap = heroRaceStats.WinLossesOnMap.Single(x => x.Map == mapName);

            return(heroRaceStatsOnMap);
        }
Пример #47
0
 public static SelfCondition IsRace(Race race) => new SelfCondition(me => me is ICharacter ch && race == ch.Race);
Пример #48
0
 public CreateCharRequestEventArgs(NetState state, IAccount a, string name, bool female, int hue, int str, int dex, int intel, CityInfo city, SkillNameValue[] skills, int shirtHue, int pantsHue, int hairID, int hairHue, int beardID, int beardHue, int profession, Race race)
 {
     State      = state;
     Account    = a;
     Name       = name;
     Female     = female;
     Hue        = hue;
     Str        = str;
     Dex        = dex;
     Int        = intel;
     City       = city;
     Skills     = skills;
     ShirtHue   = shirtHue;
     PantsHue   = pantsHue;
     HairID     = hairID;
     HairHue    = hairHue;
     BeardID    = beardID;
     BeardHue   = beardHue;
     Profession = profession;
     Race       = race;
 }
Пример #49
0
        private static void RaceChangeReply(NetState state, PacketReader pvSrc)
        {
            RaceChangeState raceChangeState;

            if (!m_Pending.TryGetValue(state, out raceChangeState))
            {
                return;
            }

            CloseCurrent(state);

            PlayerMobile pm = state.Mobile as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            IRaceChanger owner      = raceChangeState.m_Owner;
            Race         targetRace = raceChangeState.m_TargetRace;

            if (pvSrc.Size == 5)
            {
                if (owner != null)
                {
                    owner.OnCancel(pm);
                }

                return;
            }

            if (!CanChange(pm, targetRace) || (owner != null && !owner.CheckComplete(pm)))
            {
                return;
            }

            int hue              = pvSrc.ReadUInt16();
            int hairItemId       = pvSrc.ReadUInt16();
            int hairHue          = pvSrc.ReadUInt16();
            int facialHairItemId = pvSrc.ReadUInt16();
            int facialHairHue    = pvSrc.ReadUInt16();

            pm.Race = targetRace;
            pm.Hue  = targetRace.ClipSkinHue(hue) | 0x8000;

            if (targetRace.ValidateHair(pm, hairItemId))
            {
                pm.HairItemID = hairItemId;
                pm.HairHue    = targetRace.ClipHairHue(hairHue);
            }
            else
            {
                pm.HairItemID = 0;
            }

            if (targetRace.ValidateFacialHair(pm, facialHairItemId))
            {
                pm.FacialHairItemID = facialHairItemId;
                pm.FacialHairHue    = targetRace.ClipHairHue(facialHairHue);
            }
            else
            {
                pm.FacialHairItemID = 0;
            }

            if (targetRace == Race.Human)
            {
                pm.SendLocalizedMessage(1073654);                   // You are now fully human.
            }
            else if (targetRace == Race.Elf)
            {
                pm.SendLocalizedMessage(1073653);                   // You are now fully initiated into the Elven culture.
            }
            else
            {
                pm.SendMessage("You have fully changed your race to {0}.", targetRace.Name);
            }

            if (owner != null)
            {
                owner.ConsumeNeeded(pm);
            }
        }
Пример #50
0
 public void SetRace(Race race)
 {
     SetUpdateFieldValue(m_values.ModifyValue(m_corpseData).ModifyValue(m_corpseData.RaceID), (byte)race);
 }
Пример #51
0
 public static void RegisterRace(Race race)
 {
     Race.Races[race.RaceIndex] = race;
     Race.AllRaces.Add(race);
 }
Пример #52
0
 public bool IsSupported(Race race)
 {
     return(race.Enrolled && race.Status() != Race.ActiveStatus.Upcoming);
 }
Пример #53
0
        private void BtnInsert_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (ScreenMode.Location == screenmode)
                {
                    if (string.IsNullOrEmpty(txtDescription.Text))
                    {
                        throw new Exception("Please enter a location");
                    }

                    Location location = new Location();

                    if (locations.Any(l => l.Description == txtDescription.Text))
                    {
                        throw new Exception("This location has already exists.");
                    }
                    else
                    {
                        location.Description = txtDescription.Text;
                    }

                    //Send it to the API
                    HttpClient client             = InitializeClient();
                    string     serializedLocation = JsonConvert.SerializeObject(location);
                    var        content            = new StringContent(serializedLocation);
                    content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
                    HttpResponseMessage response = client.PostAsync("Location", content).Result;

                    if (response.StatusCode == System.Net.HttpStatusCode.OK || response.StatusCode == System.Net.HttpStatusCode.NoContent)
                    {
                        //Get the new location Id
                        response = client.GetAsync("Location?description=" + location.Description).Result;
                        string   result            = response.Content.ReadAsStringAsync().Result;
                        Location retrievedLocation = JsonConvert.DeserializeObject <Location>(result);

                        //Save the Id so that we can update it.
                        location.Id = retrievedLocation.Id;

                        locations.Add(location);
                        Rebind();

                        //Select the inserted location
                        cboAttribute.SelectedIndex = locations.FindIndex(p => p == location);
                    }
                    else
                    {
                        throw new Exception("Location could not be inserted");
                    }
                }
                else if (ScreenMode.Gender == screenmode)
                {
                    if (string.IsNullOrEmpty(txtDescription.Text))
                    {
                        throw new Exception("Please enter a gender");
                    }

                    Gender gender = new Gender();

                    if (genders.Any(l => l.Description == txtDescription.Text))
                    {
                        throw new Exception("This gender has already exists.");
                    }
                    else
                    {
                        gender.Description = txtDescription.Text;
                    }

                    //Send it to the API
                    HttpClient client           = InitializeClient();
                    string     serializedGender = JsonConvert.SerializeObject(gender);
                    var        content          = new StringContent(serializedGender);
                    content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
                    HttpResponseMessage response = client.PostAsync("Gender", content).Result;

                    if (response.StatusCode == System.Net.HttpStatusCode.OK || response.StatusCode == System.Net.HttpStatusCode.NoContent)
                    {
                        //Get the new location Id
                        response = client.GetAsync("Gender?description=" + gender.Description).Result;
                        string result          = response.Content.ReadAsStringAsync().Result;
                        Gender retrievedGender = JsonConvert.DeserializeObject <Gender>(result);

                        //Save the Id so that we can update it.
                        gender.Id = retrievedGender.Id;

                        genders.Add(gender);
                        Rebind();

                        //Select the inserted location
                        cboAttribute.SelectedIndex = genders.FindIndex(p => p == gender);
                    }
                    else
                    {
                        throw new Exception("Gender could not be inserted");
                    }
                }
                else if (ScreenMode.Race == screenmode)
                {
                    if (string.IsNullOrEmpty(txtDescription.Text))
                    {
                        throw new Exception("Please enter a race");
                    }

                    Race race = new Race();

                    if (races.Any(l => l.Description == txtDescription.Text))
                    {
                        throw new Exception("This race has already exists.");
                    }
                    else
                    {
                        race.Description = txtDescription.Text;
                    }

                    //Send it to the API
                    HttpClient client         = InitializeClient();
                    string     serializedRace = JsonConvert.SerializeObject(race);
                    var        content        = new StringContent(serializedRace);
                    content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
                    HttpResponseMessage response = client.PostAsync("Race", content).Result;

                    if (response.StatusCode == System.Net.HttpStatusCode.OK || response.StatusCode == System.Net.HttpStatusCode.NoContent)
                    {
                        //Get the new location Id
                        response = client.GetAsync("Race?description=" + race.Description).Result;
                        string result        = response.Content.ReadAsStringAsync().Result;
                        Race   retrievedRace = JsonConvert.DeserializeObject <Race>(result);

                        //Save the Id so that we can update it.
                        race.Id = retrievedRace.Id;


                        races.Add(race);
                        Rebind();


                        //Select the inserted location
                        cboAttribute.SelectedIndex = races.FindIndex(p => p == race);
                    }
                    else
                    {
                        throw new Exception("Race could not be inserted");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error!");
            }
        }
Пример #54
0
 /**
  * Get the cost of this entire production queue item quanity
  */
 public Cost getCost(Race race)
 {
     return(getCostOfOne(race).multiply(quantity));
 }
Пример #55
0
 private void norvic_Click(object sender, RoutedEventArgs e)
 {
     this.SelectedRace = Game.Races["Norvic"];
     this.SetSelection(norvic);
 }
Пример #56
0
 private void najii_Click(object sender, RoutedEventArgs e)
 {
     this.SelectedRace = Game.Races["Najii"];
     this.SetSelection(najii);
 }
Пример #57
0
        /// <summary>
        /// Populate Person List
        /// </summary>
        /// <returns></returns>
        private List <Person> PopulatePersonList()
        {
            List <Person> people = new List <Person>();

            Random rnd = new Random();


            for (int i = 0; i < 10000; i++)
            {
                var  randomRace = rnd.Next(1, 5);//Get Random race
                Race race       = (Race)randomRace;

                switch (race)
                {
                case Race.Angles:

                    people.Add(new Angles()
                    {
                        Name = "Person #" + i.ToString(),
                        Age  = rnd.Next(1, 99) + 1,    //add 1 year,
                        Race = "Angles"
                    });

                    break;

                case Race.Saxons:

                    people.Add(new Saxons()
                    {
                        Name = "Person #" + i.ToString(),
                        Age  = rnd.Next(1, 99) + 1,    //add 1 year,
                        Race = "Saxons"
                    });

                    break;

                case Race.Jutes:

                    people.Add(new Jutes()
                    {
                        Name = "Person #" + i.ToString(),
                        Age  = rnd.Next(1, 99) + 1,    //add 1 year,
                        Race = "Jutes"
                    });

                    break;

                case Race.Hawaiian:

                    people.Add(new Hawaiian()
                    {
                        Name = "Person #" + i.ToString(),
                        Age  = rnd.Next(1, 99) + 1,    //add 1 year
                        Race = "Hawaiian"
                    });

                    break;
                }
            }

            return(people);
        }
Пример #58
0
 private void peren_Click(object sender, RoutedEventArgs e)
 {
     this.SelectedRace = Game.Races["Peren"];
     this.SetSelection(peren);
 }
Пример #59
0
        public virtual Race getRace()
        {
            Race ret = new Race(bwapiPINVOKE.Player_getRace(swigCPtr), true);

            return(ret);
        }
Пример #60
0
 public string RaceString()
 {
     return(Race.ToString());
 }