コード例 #1
0
ファイル: SceneManager.cs プロジェクト: itamargreen/metalx
 protected void DrawCHR(CHR chr)
 {
     if (chr == null)
     {
         return;
     }
     if (chr.TextureName == null)
     {
         return;
     }
     if (chr.Invisible)
     {
         return;
     }
     if (chr.TextureIndex < 0)
     {
         chr.TextureIndex = game.Textures.GetIndex(chr.TextureName);
     }
     Rectangle dz = new Rectangle();
     dz.Y = (int)chr.RealDirection * game.Textures[chr.TextureIndex].TileSize.Height;
     if (chr.NeedMovePixel > 0 && chr.IsRigor == false)
     {
         dz.X = (((int)((float)game.Options.TilePixelX - chr.NeedMovePixel)) / (game.Options.TileSizePixelX.Width / 4) + 1) * game.Textures[chr.TextureIndex].TileSize.Width;
     }
     else
     {
         dz.X = 0;
     }
     //if (chr is NPC)
     //{
     //    if (((NPC)chr).IsDoor)
     //    {
     //        dz.Y += (2 - chr.Size.Height) * game.Textures[chr.TextureIndex].TileSize.Height;
     //    }
     //}
     Size tdz = game.Textures[chr.TextureIndex].TileSize;
     tdz.Width *= chr.Size.Width;
     tdz.Height *= chr.Size.Height;
     //if (chr is NPC)
     //{
     //    if (((NPC)chr).IsDoor)
     //    {
     //        tdz.Height *= 2;
     //    }
     //}
     dz.Size = tdz;
     Vector3 v31 = chr.RealLocationPixel;
     v31.Y += game.Options.SpriteOffsetPixel;
     v31.X += game.SCN.RealLocationPixel.X;
     v31.Y += game.SCN.RealLocationPixel.Y;
     v31.Z += game.SCN.RealLocationPixel.Z;
     v31 = Util.Vector3AddVector3(v31, ScreenOffsetPixel);
     if (chr is NPC)
     {
         if (((NPC)chr).IsDoor)
         {
             v31.Y -= game.Options.TileSizePixelX.Height * (chr.Size.Height - 1);
         }
     }
     Size dsize = game.Options.TileSizePixelX;
     dsize.Width *= chr.Size.Width;
     dsize.Height *= chr.Size.Height;
     //if (chr is NPC)
     //{
     //    if (((NPC)chr).IsDoor)
     //    {
     //        dsize.Height *= 2;
     //    }
     //}
     float rot = 0;
     game.DrawMetalXTexture(
         game.Textures[chr.TextureIndex],
         dz,
         v31,
         dsize,
         rot,
         Util.MixColor(chr.ColorFilter, ColorFilter));
 }
コード例 #2
0
ファイル: GUI.cs プロジェクト: itamargreen/metalx
        void LoadContext(CHR chr)
        {
            chr.HeadTextureName = chr.TextureName + "_icon";

            //this.head.Texture.Index = chr.HeadTextureIndex;
            this.head.Texture.Name = chr.HeadTextureName;

            this.nam.Text = "名字: " + chr.Name;

            this.hp.Text = "HP: " + chr.HP + " / " + chr.HPMax;

            this.lv.Text = "LV: " + chr.Level;
            this.chrlv.Text = "徒步战LV: " + chr.CBLevel;
            this.mtllv.Text = "驾驶战LV: " + chr.MBLevel;

            this.exp.Text = "经验: " + chr.EXP;
            try
            {
                this.dmg.Text = "攻击: " + chr.Weapon.Damage.ToString("f1") + "\n命中: " + chr.Accurate.ToString("f1") + "%";
                this.def.Text = "防御: " + chr.Defense.ToString("f1") + "\n闪避: " + chr.Missrate.ToString("f1") + "%";
            }
            catch
            {
                this.dmg.Text = "攻击: 0";
                this.def.Text = "防御: 0";
            }
            this.str.Text = "力量: " + chr.Strength;
            this.agi.Text = "敏捷: " + chr.Agility;
            this.itl.Text = "智力: " + chr.Intelligence;
            this.phy.Text = "体质: " + chr.Physique;

            string name;
            string icon_name;
            //if (chr.Equipments[(int)EquipmentCHRType.Weapon].Name != null)
            //{
            //    name = chr.Equipments[(int)EquipmentCHRType.Weapon].Name;
            //    icon_name = chr.Equipments[(int)EquipmentCHRType.Weapon].Icon.Name;
            //}
            //else
            //{
            //    name = "X";
            //    icon_name = "icon_" + ((EquipmentCHRType)(int)EquipmentCHRType.Weapon).ToString().ToLower();
            //}
            //this.b_weapon.Index = 0;
            //this.b_weapon.WaitTextBox.Location = new Point(48, 4);
            //this.b_weapon.WaitTextBox.Text = name;
            //this.b_weapon.WaitTextureBox.Texture.Name = icon_name;
            //this.b_weapon.WaitTextureBox.Size = new Size(48, 32);

            //this.b_weapon.SameAsWait();
            for (int i = 0; i < 8; i++)
            {
                if ( chr.Equipments[i].Name != null)
                {
                    name = chr.Equipments[i].Name;
                    icon_name = chr.Equipments[i].Icon.Name;
                }
                else
                {
                    name = "无";
                    icon_name = "icon_" + ((EquipmentCHRType)i).ToString().ToLower();
                }
                this.b_equip[i].Index = i;
                this.b_equip[i].WaitTextBox.Location = new Point(48, 4);
                this.b_equip[i].WaitTextBox.Text = name;
                this.b_equip[i].WaitTextureBox.Texture.Name = icon_name;
                this.b_equip[i].WaitTextureBox.Size = new Size(48, 32);
                this.b_equip[i].SameAsWait();
            }
        }
コード例 #3
0
ファイル: BattleManager.cs プロジェクト: itamargreen/metalx
 void DrawCHR(CHR chr)
 {
     Vector3 loc = chr.BattleMovie.DrawLocation;
     loc = Util.Vector3AddVector3(loc, this.ScreenOffsetPixel);
     Color color = Util.MixColor(ColorFilter, chr.BattleMovie.ColorFilter);
     game.DrawMetalXTexture(chr.BattleMovie.MXT, chr.BattleMovie.DrawZone, loc, chr.BattleMovie.TileSize2X, 0, color);
 }
コード例 #4
0
ファイル: GUI.cs プロジェクト: itamargreen/metalx
        void LoadContext(CHR chr)
        {
            ControlBoxes.Clear();
            ControlBoxes.Add(BGTextureBox);
            ControlBoxes.Add(tb);
            for (int i = 0; i < chr.Bag.Count; i++)
            {
                if (chr.Bag[i] != null)
                {
                    bb[i].Index = i;
                    //bb[i].Location = new Point(160 + 160 * (i / 8), 64 + 32 * (i % 8));
                    bb[i].Location = new Point(24, 24 + 24 * i);

                    bb[i].WaitTextBox.Location = new Point(48, 4);
                    bb[i].WaitTextBox.Text = chr.Bag[i].Name;
                    //bb[i].WaitTextBox.FontSize = 15;
                    bb[i].WaitTextureBox.Texture.Name = chr.Bag[i].Icon.Name;
                    //bb[i].WaitTextureBox.Texture.Index = -1;
                    bb[i].WaitTextureBox.Size = new System.Drawing.Size(48, 32);
                    bb[i].SameAsWait();

                    bb[i].OnButtonUp += new ButtonBoxEvent(MenuBAG_OnButtonUp);
                    bb[i].OnButtonFocus += new ButtonBoxEvent(MenuBAG_OnButtonFocus);

                    ControlBoxes.Add(bb[i]);
                }
            }
            FocusNowButtonBox();

            if (NowButtonBoxIndex >= chr.Bag.Count)
            {
                FocusLastButtonBox();
            }
        }
コード例 #5
0
ファイル: Game.cs プロジェクト: itamargreen/metalx
 public NPC GetNPC(CHR chr)
 {
     foreach (NPC npc in NPCs)
     {
         //if (npc.Invisible == false)
         if (npc.RealLocation == chr.FrontLocation)
         {
             return npc;
         }
     }
     foreach (NPC npc in NPCs)
     {
         //if (npc.Invisible == false)
         if (npc.RealLocation == chr.RangeLocation)
         {
             if (SCN.CodeLayer[chr.FrontLocation].IsDesk)
             {
                 return npc;
             }
         }
     }
     return null;
 }