Esempio n. 1
0
 /// <summary>
 /// 创建一个玩家
 /// </summary>
 /// <param name="charData"></param>
 public void CreatePlayer(CharData charData)
 {
     ViewPlayer obj = new ViewPlayer();
     obj.Create(charData, this);
     viewOjbList.Add(obj);
     _logicMap.gameObjList.Add(obj.gameObj);
 }
Esempio n. 2
0
 /// <summary>
 /// 创建玩家自己
 /// </summary>
 /// <param name="charData"></param>
 public void CreateMe(CharData charData)
 {
     MeViewPlayer obj = new MeViewPlayer();
     obj.Create(charData, this);
     viewOjbList.Add(obj);
     _logicMap.gameObjList.Add(obj.gameObj);
     CurViewObj = obj;
 }
Esempio n. 3
0
 public override void Create(CharData charData, ViewMap viewMap)
 {
     _viewMap = viewMap;
     gameObj = new Player();
     gameObj.Init(charData, viewMap.LogicMap);
     gameGo = GameObject.CreatePrimitive(PrimitiveType.Cube);
     gameGo.name = charData.name;
     gameTrans = gameGo.transform;
 }
Esempio n. 4
0
 public override void Create(CharData charData, ViewMap viewMap)
 {
     _viewMap = viewMap;
     gameObj = new MePlayer();
     gameObj.Init(charData, viewMap.LogicMap);
     //            gameGo = new GameObject();
     gameGo = GameObject.CreatePrimitive(PrimitiveType.Cube);
     gameGo.name = charData.name;
     gameGo.AddComponent<PlayerMoveController>();
     gameTrans = gameGo.transform;
 }
Esempio n. 5
0
        public FontRenderer(Font font)
        {
            Font = font;
            charHeight = -Font.Height;
            GlyphBitmap = new Bitmap(TextureSize.Width, TextureSize.Height);

            texture = new Texture(GL.GenTexture());
            GL.BindTexture(TextureTarget.Texture2D, texture.GetId());
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.Linear);

            using (Graphics gfx = Graphics.FromImage(GlyphBitmap))
            {
                //this supposedly improves perforance
                //Application.SetCompatibleTextRenderingDefault(false);

                StringFormat format = new StringFormat(StringFormat.GenericTypographic);
                Point charPoint = new Point(0, 0);
                for (int i = 0; i < chars.Length; i++)
                {
                    SizeF charSizeF = gfx.MeasureString(new string(new Char[1] { Convert.ToChar(i) }), Font, 0, format);

                    Size charSize = new Size((int)Math.Ceiling(charSizeF.Width), (int)Math.Ceiling(charSizeF.Height));

                    //fudge factor to prevent glyphs from overlapping
                    charSize.Width += 2;

                    if (charSize.Width + charPoint.X > TextureSize.Width)
                    {
                        charPoint.X = 0;
                        charPoint.Y += (int)Math.Ceiling(Font.GetHeight());
                    }
                    chars[i] = new CharData(new Rectangle(charPoint, charSize), this);
                    charPoint.X += charSize.Width;
                }

                gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
                gfx.Clear(Color.Transparent);
                for (int i = 0; i < chars.Length; i++)
                {
                    PointF point = new PointF(chars[i].PixelRegion.X, chars[i].PixelRegion.Y);
                    gfx.DrawString(new string(new Char[1] { Convert.ToChar(i) }), Font, new SolidBrush(Color.Black), point);
                }
            }

            BitmapData data = GlyphBitmap.LockBits(new Rectangle(0, 0, GlyphBitmap.Width, GlyphBitmap.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, TextureSize.Width, TextureSize.Height, 0, Format, PixelType.UnsignedByte, data.Scan0);
            GlyphBitmap.UnlockBits(data);
        }
Esempio n. 6
0
 /// <summary>
 /// 创建玩家
 /// </summary>
 /// <param name="players"></param>
 public void CreateAllPlayer(string players)
 {
     string[] playStr = players.Split(';');
     for(int i = 0; i < playStr.Length; ++i)
     {
         CharData charData = new CharData(playStr[i]);
         if(charData.roleId == LogicMap.curRoleId)
         {
             CreateMe(charData);
         }
         else
         {
             CreatePlayer(charData);
         }
     }
 }
Esempio n. 7
0
 public override void Init(CharData charData, GameMap gameMap)
 {
     base.Init(charData, gameMap);
 }
Esempio n. 8
0
 public CharData[] GetChar(int[] index)
 {
     CharData[] charData = new CharData[index.Length];
     for (int i = 0; i < index.Length; i++)
     {
         charData[i] = chars[index[i]];
     }
     return charData;
 }
Esempio n. 9
0
 public virtual void Init(CharData charData, GameMap gameMap)
 {
     _charData = charData;
     _gameMap = gameMap;
     Id = charData.roleId;
 }
Esempio n. 10
0
 public override void Init(CharData charData, GameMap gameMap)
 {
     base.Init(charData, gameMap);
 }
Esempio n. 11
0
 public override void Init(CharData charData, GameMap gameMap)
 {
     base.Init(charData, gameMap);
     _gameMap.curObj = this;
 }
Esempio n. 12
0
 public override void Init(CharData charData, LogicEntityManager gameMap)
 {
     base.Init(charData, gameMap);
     GlobalClient.GameManager.LogicManager.playerEntity = this;
 }
Esempio n. 13
0
 public override void Init(CharData charData, GameMap gameMap)
 {
     base.Init(charData, gameMap);
     _gameMap.curObj = this;
 }
Esempio n. 14
0
 public override void Init(CharData charData, LogicEntityManager gameMap)
 {
     base.Init(charData, gameMap);
     _mActorState = new StandActorState(this);
 }