Ejemplo n.º 1
0
        private void SetupPlayers()
        {
            var data = Data.DataCreater.Instance;

            foreach (var v in data.playerCharacters)
            {
                if (v.HP.Now == 0)
                {
                    v.HP.Now = 1;
                }
            }

            if (retrayPlayerCaracters == null)
            {
                retrayPlayerCaracters = new List <Character>();

                foreach (var v in data.playerCharacters)
                {
                    var chara = new Data.Character();
                    chara.HP.Now          = v.HP.Now;
                    chara.elementTimer    = v.elementTimer;
                    chara.ElementLing.pos = v.ElementLing.pos;
                    foreach (var element in v.Elements)
                    {
                        chara.Elements.Add(new Element(element.Name));
                    }
                    retrayPlayerCaracters.Add(chara);
                }
            }
        }
Ejemplo n.º 2
0
        public CharacterController(AccountController accountController, Data.Character characterData)
        {
            Character             = characterData;
            Character.GroupMember = new List <GroupMember>(); // even kieken of 't nog nodig is.

            AccountController = accountController;

            FormatName = Character.Name.Replace("_", " ");
            // SetActiveGroup(Character.ActiveGroup); TODO: Fix

            LoadProperties();
            switch (Character.RegistrationStep)
            {
            case 0:
                API.shared.sendChatMessageToPlayer(accountController.Client, string.Format("~w~Welcome {0} to ~g~{1}~w~. This is your first visit. Enjoy your stay!", FormatName, Global.GlobalVars.ServerName));
                break;

            default:
                API.shared.sendChatMessageToPlayer(accountController.Client, string.Format("~w~Welcome back {0}! Your last login was at {1}", FormatName, Character.LastLoginDate));
                break;
            }

            Character.LastLoginDate = DateTime.Now;
            Character.Online        = true;
            ContextFactory.Instance.SaveChanges();
        }
Ejemplo n.º 3
0
 public Pet(Data.Character AssocPet, bool IsAlive, uint ObjectId, string Name, string OwnerName)
 {
     this.AssocPet  = AssocPet;
     this.IsAlive   = IsAlive;
     this.ObjectId  = ObjectId;
     this.Name      = Name;
     this.OwnerName = OwnerName;
 }
Ejemplo n.º 4
0
        public SkillCard(System.Drawing.Bitmap cardImage, Vector2D position, string viewName, string cost, Data.Character ownerCharacter, Data.ActionSkill actionSkill)
        {
            this.cardImage      = cardImage;
            this.position       = position;
            this.ownerCharacter = ownerCharacter;
            this.cost           = cost;
            this.actionSkill    = actionSkill;

            {
                var bmp     = cardImage;
                var texture = new Texture(bmp);
                var w       = 160;
                var h       = (int)((double)bmp.Height / (double)bmp.Width * w);
                var sprite  = new ImageSprite(texture, new Rect(new Vector2D(position.X, position.Y), new Vector2D(w, h)), new Color(1, 1, 1, 1));
                layer.Add(sprite, 10);

                size           = new Vector2D(w, h);
                mySprites.face = sprite;
            }

            {
                var x    = position.X - 5;
                var y    = position.Y + 200;
                var font = new Font(Config.MainConfig.MainFontPath, 16, new Color(1, 1, 1, 1), new Font.FontFrame[] {
                    new Font.FontFrame(2, new Color(1, 0, 0, 0)),
                }, 0);
                var ts = new TextSprite(viewName, font, new Vector2D(x, y));

                layer.Add(ts, 20);
                mySprites.viewName = ts;
            }
            {
                var x      = position.X;
                var y      = position.Y + 227;
                var w      = size.X;
                var h      = 1;
                var sprite = new PlaneSprite(new Rect(new Vector2D(x, y), new Vector2D(w, h)), new Color(0.3, 1, 1, 1));
                layer.Add(sprite, 10);
                mySprites.bar = sprite;
            }
            {
                var x    = position.X - 5;
                var y    = position.Y + 225;
                var font = new Font(Config.MainConfig.MainFontPath, 12, new Color(1, 1, 1, 1), new Font.FontFrame[] {
                    new Font.FontFrame(2, new Color(1, 0, 0, 0)),
                }, 0);
                var ts = new TextSprite(cost, font, new Vector2D(x, y));
                //var ts = new TextSprite(cost, "data/font/rounded-mgenplus-1cp-medium.ttf", 12, new Vector2D(x, y), new Color(1, 1, 1, 1));
                layer.Add(ts, 20);
                mySprites.ViewStatus = ts;
            }

            {
                var sprite = new PlaneLineSprite(new Rect(position, size), new Color(0.5, 1, 1, 1));
                layer.Add(sprite, 30);
                mySprites.mouseOn = sprite;
            }
        }
Ejemplo n.º 5
0
        private void SetupEnemys()
        {
            var data = Data.DataCreater.Instance;

            data.enemyCharacters.Clear();

            foreach (var command in scriptAPI.__enemyCommands)
            {
                var enemeyCreator = new Data.EnemyCreator(command);

                var chara = new Data.Character();
                chara.ViewName             = enemeyCreator.scriptAPI.Name;
                chara.imagePath            = enemeyCreator.scriptAPI.ImagePath;
                chara.imageScale           = 1.0;// enemeyCreator.scriptAPI.ImageScale;
                chara.imageSideMargin      = enemeyCreator.scriptAPI.ImageSideMargin;
                chara.HP.Now               = chara.HP.Base = chara.HP.Max = enemeyCreator.scriptAPI.HP;
                chara.HPBarFrameWidthScale = enemeyCreator.scriptAPI.HPBarFrameWidthScale;

                foreach (var i in enemeyCreator.scriptAPI.BattleStatusBaseParams)
                {
                    foreach (var j in chara.BattleStatusParams)
                    {
                        if (i.Key == j.Key)
                        {
                            j.Value.Base = j.Value.Now = i.Value;
                            break;
                        }
                    }
                }

                foreach (var ad in enemeyCreator.scriptAPI.ActionSkillDatas)
                {
                    var datas = Data.ActionSkillDatas.Instance;

                    foreach (var i in datas.Items)
                    {
                        if (i.Name == ad.Name)
                        {
                            chara.Actions.Add(i);
                            break;
                        }
                    }
                }

                foreach (var p in enemeyCreator.scriptAPI.DefalutStockElement)
                {
                    chara.Elements.Add(new Data.Element(p.ToString()));
                }

                foreach (var p in enemeyCreator.scriptAPI.ElementLingPart)
                {
                    chara.ElementLing.Bodys.Add(p);
                }

                data.enemyCharacters.Add(chara);
            }
        }
Ejemplo n.º 6
0
        public PlayerController(Client player)
        {
            this.AccountData   = new Data.Account();
            this.CharacterData = new Data.Character();

            this.player            = player;
            this.muted             = true;
            this.LoggedIn          = false;
            this.SelectedCharacter = false;

            EntityManager.Add(this);
        }
Ejemplo n.º 7
0
        public void Add(Data.Character character)
        {
            var num     = cards.Count;
            var wMargin = 200;
            var y       = 600;
            var x       = 50;

            var sprite = new PlayerCard(new Vector2D(x + wMargin * num, y), character);

            layer.Add(sprite, 10);
            cards.Add(sprite);
        }
Ejemplo n.º 8
0
        public void Add(Data.Character character)
        {
            var num     = cards.Count;
            var wMargin = 200;
            var y       = 600;
            var x       = 50;

            var bmp    = new System.Drawing.Bitmap(character.imagePath);
            var sprite = new EnemyCard(bmp, new Vector2D(x + wMargin * num, y), character.Name, character);

            layer.Add(sprite, 10);
            cards.Add(sprite);
            character.enemyCard = sprite;
            SetupCardPos();
        }
Ejemplo n.º 9
0
        public void Add(System.Drawing.Bitmap bmp, Data.Character character, Data.ActionSkill actionSkill)
        {
            var texture = new Texture(bmp);
            var w       = 180;
            //var w = 160;
            var h      = (int)((double)bmp.Height / (double)bmp.Width * w);
            var x      = 1;
            var y      = 1;
            var sprite = new SkillCard(bmp, new Vector2D(x, y), actionSkill.Name, actionSkill.Cost, character, actionSkill);

            layer.Add(sprite, 10);
            cards.Add(sprite);
            sprite.Update();

            sprite.SetEnable(false);
        }
Ejemplo n.º 10
0
        public static void SelectCharacter(Client player, int selectId)
        {
            AccountController account = player.getData("ACCOUNT");

            if (account == null)
            {
                return;
            }

            if (account.Account.Character.Count() == 0)
            {
                API.shared.sendChatMessageToPlayer(player, "You have no characters.");
            }
            else
            {
                int                 characterid         = account.Account.Character.ToList()[selectId - 1].Id;
                Data.Character      characterData       = ContextFactory.Instance.Character.FirstOrDefault(x => x.Id == characterid);
                CharacterController characterController = new CharacterController(account, characterData);
                characterController.LoginCharacter(account);
            }
        }
Ejemplo n.º 11
0
        public override void Update()
        {
            isInputEventNowFrame = false;
            //uiStep
            switch (uiStep)
            {
            case UIStep.None:
                break;

            case UIStep.SkillSelect:
                break;

            case UIStep.SkillTargetSelect:
            {
                if ((InputCore.Instance.GetKeyEventType(InputCore.KeyEventCode.MouseRightButton) == InputCore.KeyEventType.Up))
                {
                    if (!isInputEventNowFrame)
                    {
                        isInputEventNowFrame = true;
                        uiStep = UIStep.None;
                        new Emugen.Sound.SoundPlayer(MainConfig.SoundEffect.UICancel01, 0.10f, false, Emugen.Sound.SoundPlayer.SoundType.SE);
                    }
                }
            }
            break;
            }

            if (battleStep == BattleStep.Main)
            {
                Data.DataCreater.Instance.Update();                                // 行動シンボルの増加を戦闘中のみに限定するためのif文
            }
            SkillCards.Update();
            PlayerCards.Update();
            EnemyCards.Update();


            switch (battleStep)
            {
            case BattleStep.Main:
                if (actionTimer == 0)
                {
                    Action         action    = null;
                    Data.Character character = null;
                    foreach (var i in DataCreater.Instance.playerCharacters)
                    {
                        if (i.ActionStock != null)
                        {
                            action    = i.ActionStock;
                            character = i;
                        }
                    }
                    foreach (var i in DataCreater.Instance.enemyCharacters)
                    {
                        if (i.ActionStock != null)
                        {
                            action    = i.ActionStock;
                            character = i;
                        }
                    }
                    if (action != null)
                    {
                        action();
                        character.ActionStock = null;
                    }
                    actionTimer = actionTimerMax;
                }
                else
                {
                    actionTimer--;
                }

                if (EnemyCards.Count == 0)
                {
                    battleStep = BattleStep.End;

                    var bgm = new Emugen.Sound.SoundPlayer(Config.MainConfig.BattleScene.BGMStageClear, 0.20f, true, Emugen.Sound.SoundPlayer.SoundType.BGM);
                }
                else if (DataCreater.Instance.IsPlayerCharacterAllDead())
                {
                    battleStep = BattleStep.LostClickWait;

                    var choice = new UI.Talk.Choice(new string[] { "もう一度戦う", "タイトルに戻る" });
                    layer.Add(choice, 200);

                    LostClickWaitChoice = choice;
                    var bgm = new Emugen.Sound.SoundPlayer(Config.MainConfig.BattleScene.BGMGameOver, 0.20f, true, Emugen.Sound.SoundPlayer.SoundType.BGM);
                }
                else
                {
                    var data = Data.DataCreater.Instance;

                    var tmp = new List <Data.Character>();

                    foreach (var i in data.enemyCharacters.Where(x => x.HP.Now <= 0))
                    {
                        tmp.Add(i);
                    }

                    foreach (var i in tmp)
                    {
                        EnemyCards.Del(i.enemyCard);
                        data.enemyCharacters.Remove(i);
                    }
                }
                break;

            case BattleStep.LostClickWait:
            {
                LostClickWaitChoice.Update();

                var input = Emugen.Input.InputCore.Instance;
                if ((input.GetKeyEventType(Emugen.Input.InputCore.KeyEventCode.MouseLeftButton) == Emugen.Input.InputCore.KeyEventType.Up))
                {
                    var tmp = LostClickWaitChoice.GetChoiseText();

                    switch (tmp)
                    {
                    case "もう一度戦う":
                    {
                        var data = Data.DataCreater.Instance;
                        var i    = 0;
                        foreach (var v in retrayPlayerCaracters)
                        {
                            var chara = data.playerCharacters[i];
                            chara.HP.Now          = v.HP.Now;
                            chara.elementTimer    = v.elementTimer;
                            chara.ElementLing.pos = v.ElementLing.pos;
                            chara.Elements.Clear();
                            foreach (var element in v.Elements)
                            {
                                chara.Elements.Add(new Element(element.Name));
                            }
                            i++;
                        }
                        WindowManager.nextScene = new Scene.BattleScene(this.script.Path);
                    }
                    break;

                    case "タイトルに戻る":
                    {
                        WindowManager.nextScene = new Scene.TitleScene();
                    }
                    break;
                    }
                }
            }
            break;

            case BattleStep.End:
            {
                var input = Emugen.Input.InputCore.Instance;
                if ((input.GetKeyEventType(Emugen.Input.InputCore.KeyEventCode.MouseLeftButton) == Emugen.Input.InputCore.KeyEventType.Up))
                {
                    WindowManager.nextScene = new Scene.TalkScene(scriptAPI.__nextTalkScriptPath);
                }
            }
            break;
            }
        }
Ejemplo n.º 12
0
 public NPC(Data.Character AssocNPC, uint ObjectId, string Name)
 {
     this.AssocNPC = AssocNPC;
     this.ObjectId = ObjectId;
 }
Ejemplo n.º 13
0
        public PlayerCard(Vector2D position, Data.Character character)
        {
            //var cardImage = default(System.Drawing.Bitmap);
            this.character = character;
            this.cardImage = new System.Drawing.Bitmap(character.imagePath);
            this.position  = position;

            character.playerCard = this;

            {
                var bmp     = cardImage;
                var texture = new Texture(bmp);
                var w       = 160;
                var h       = (int)((double)bmp.Height / (double)bmp.Width * w);
                var sprite  = new ImageSprite(texture, new Rect(new Vector2D(position.X, position.Y), new Vector2D(w, h)), new Color(1, 1, 1, 1));
                layer.Add(sprite, 10);

                size           = new Vector2D(w, h);
                mySprites.face = sprite;
            }

            {
                var x      = 0;
                var y      = 0;
                var w      = 60;
                var h      = 6;
                var sprite = new PlaneSprite(new Rect(new Vector2D(x, y), new Vector2D(w, h)), new Color(0.75, 0, 1, 0.5));
                layer.Add(sprite, 10);
                mySprites.elementTimerBar = sprite;
            }
            {
                var x      = 0;
                var y      = 0;
                var w      = 60 + 2;
                var h      = 6 + 2;
                var sprite = new PlaneLineSprite(new Rect(new Vector2D(x, y), new Vector2D(w, h)), new Color(0.5, 0, 0, 0));
                layer.Add(sprite, 10);
                mySprites.elementTimerBarFrame = sprite;
            }

            {
                var x = position.X - 5;
                var y = position.Y + 200;

                var font = new Font(Config.MainConfig.MainFontPath, 16, new Color(1, 1, 1, 1), new Font.FontFrame[] {
                    new Font.FontFrame(2, new Color(1, 0, 0, 0)),
                }, 0);
                var ts = new TextSprite(character.ViewName, font, new Vector2D(x, y));

                layer.Add(ts, 20);
                mySprites.viewName = ts;
            }
            {
                var x      = position.X;
                var y      = position.Y + 227;
                var w      = size.X;
                var h      = 1;
                var sprite = new PlaneSprite(new Rect(new Vector2D(x, y), new Vector2D(w, h)), new Color(0.3, 1, 1, 1));
                layer.Add(sprite, 10);
                mySprites.bar = sprite;
            }
            {
                var x = position.X - 5;
                var y = position.Y + 225;

                var font = new Font(Config.MainConfig.MainFontPath, 12, new Color(1, 1, 1, 1), new Font.FontFrame[] {
                    new Font.FontFrame(2, new Color(1, 0, 0, 0)),
                }, 0);
                var ts = new TextSprite($"{character.HP.Now}/{character.HP.Max}", font, new Vector2D(x, y));
                layer.Add(ts, 20);
                mySprites.ViewStatus = ts;
            }

            {
                var sprite = new PlaneLineSprite(new Rect(position, size), new Color(0.0, 1, 1, 1));
                layer.Add(sprite, 30);
                mySprites.mouseOn = sprite;
            }


            {
                var margin   = mouseOnTargetMargin;
                var filePath = character.imagePath + ".sel.png";
                var bmp2     = default(System.Drawing.Bitmap);
                if (System.IO.File.Exists(filePath))
                {
                    bmp2 = new System.Drawing.Bitmap(filePath);
                }
                else
                {
                    bmp2 = DrawUtility.DrawFrame.Draw(cardImage, margin, 8.0, 2.0, new Color(1, 0, 0.2, 1));
                    bmp2.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
                }

                var texture = new Texture(bmp2);
                var w       = 160 + margin * 2;
                var h       = (int)((double)bmp2.Height / (double)bmp2.Width * w);
                var sprite  = new ImageSprite(texture, new Rect(new Vector2D(10, 10), new Vector2D(w, h)), new Color(1, 1, 1, 1));
                layer.Add(sprite, 5);

                mouseOnTarget = sprite;
            }

            foreach (var element in character.Elements)
            {
                AddElement(element);
            }
        }
Ejemplo n.º 14
0
        public EnemyCard(System.Drawing.Bitmap cardImage, Vector2D position, string viewName, Data.Character character)
        {
            this.cardImage       = cardImage;
            this.character       = character;
            this.HPBarFrameWidth = (int)(HPBarFrameWidthBase * character.HPBarFrameWidthScale);
            character.enemyCard  = this;

            {
                var bmp     = cardImage;
                var texture = new Texture(bmp);
                var w       = (int)(bmp.Width * character.imageScale); // 160
                var h       = (int)((double)bmp.Height / (double)bmp.Width * w);
                var sprite  = new ImageSprite(texture, new Rect(new Vector2D(position.X, position.Y), new Vector2D(w, h)), new Color(1, 1, 1, 1));
                layer.Add(sprite, 10);

                size = new Vector2D(w, h);

                mySprites.face = sprite;
            }

            {
                var bmp     = new System.Drawing.Bitmap(Config.MainConfig.BattleScene.EnemyShadowImage);
                var texture = new Texture(bmp);
                var w       = 160;
                var h       = (int)((double)bmp.Height / (double)bmp.Width * w);
                var sprite  = new ImageSprite(texture, new Rect(new Vector2D(position.X, position.Y), new Vector2D(w, h)), new Color(0.8, 1, 1, 1));
                layer.Add(sprite, 5);
                mySprites.shadow = sprite;
            }

            {
                var x      = 0;
                var y      = 0;
                var w      = HPBarFrameWidth;
                var h      = 6;
                var sprite = new PlaneSprite(new Rect(new Vector2D(x, y), new Vector2D(w, h)), new Color(0.75, 1, 0.2, 0.0));
                layer.Add(sprite, 10);
                mySprites.hpBar = sprite;
            }
            {
                var x      = 0;
                var y      = 0;
                var w      = HPBarFrameWidth + 2;
                var h      = 6 + 2;
                var sprite = new PlaneLineSprite(new Rect(new Vector2D(x, y), new Vector2D(w, h)), new Color(0.5, 0, 0, 0));
                layer.Add(sprite, 10);
                mySprites.hpBarFrame = sprite;
            }

            {
                //var sprite = new PlaneLineSprite(new Rect(position, size), new Color(0.5, 1, 1, 1));
                var sprite = new PlaneSprite(new Rect(position, size), new Color(0.0, 1, 1, 1));
                layer.Add(sprite, 30);
                mySprites.mouseOn        = sprite;
                mySprites.mouseOn.IsDraw = false;
            }

            {
                var margin = mouseOnTargetMargin;

                var filePath = character.imagePath + ".sel.png";
                var bmp2     = default(System.Drawing.Bitmap);
                if (System.IO.File.Exists(filePath))
                {
                    bmp2 = new System.Drawing.Bitmap(filePath);
                }
                else
                {
                    bmp2 = DrawUtility.DrawFrame.Draw(cardImage, margin, 8.0, 2.0, new Color(1, 0, 0.2, 1));
                    bmp2.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
                }

                var texture = new Texture(bmp2);
                var w       = (int)(bmp2.Width * character.imageScale); // 160
                var h       = (int)((double)bmp2.Height / (double)bmp2.Width * w);
                var sprite  = new ImageSprite(texture, new Rect(new Vector2D(10, 10), new Vector2D(w, h)), new Color(1, 1, 1, 1));
                layer.Add(sprite, 5);

                mouseOnTarget = sprite;
            }

            foreach (var element in character.Elements)
            {
                AddElement(element);
            }
        }
Ejemplo n.º 15
0
 public Monster(Data.Character AssocMonster, uint ObjectId, bool IsAlive)
 {
     this.AssocMonster = AssocMonster;
     this.ObjectId     = ObjectId;
     this.IsAlive      = IsAlive;
 }