Example #1
0
		public void SetMessage(string context, LFont font, bool isComplete) {
			if (strings != null) {
				strings.Dispose();
			}
			this.strings = new LSTRFont(font, context);
			this.lazyHashCade = 1;
			this.wait = 0;
			this.visible = false;
			this.showMessages = new char[] { '\0' };
			this.interceptMaxString = 0;
			this.next = 0;
			this.messageCount = 0;
			this.interceptCount = 0;
			this.size = 0;
			this.tmp_left = 0;
			this.left = 0;
			this.fontSize = 0;
			this.fontHeight = 0;
			this.messages = context;
			this.next = context.Length;
			this.onComplete = false;
			this.newLine = false;
			this.messageCount = 0;
			this.messageBuffer.Clear();
			if (isComplete) {
				this.Complete();
			}
			this.visible = true;
		}
Example #2
0
 public void Dispose()
 {
     if (font != null)
     {
         font.Dispose();
         font = null;
     }
     if (dicts != null)
     {
         dicts.Clear();
         dicts = null;
     }
 }
Example #3
0
 public void Dispose()
 {
     if (font != null)
     {
         font.Dispose();
         font = null;
     }
     if (dicts != null)
     {
         dicts.Clear();
         dicts = null;
     }
 }
Example #4
0
        public static LSTRFont GetGLFont(LFont f)
        {
            if (lazyEnglish.Count > LSystem.DEFAULT_MAX_CACHE_SIZE)
            {
                ClearEnglishLazy();
            }
            string   key  = MakeLazyWestKey(f);
            LSTRFont font = (LSTRFont)CollectionUtils.Get(lazyEnglish, key);

            if (font == null)
            {
                font = new LSTRFont(f, true);
                CollectionUtils.Put(lazyEnglish, key, font);
            }
            return(font);
        }
Example #5
0
 public void SetShowFPS(bool showFps)
 {
     this.isFPS = showFps;
     if (showFps && fpsFont == null)
     {
         this.fpsFont = new LSTRFont(LFont.GetFont(20), pFontString);
     }
 }
Example #6
0
 public void FinishApp()
 {
     if (!LSystem.isDestroy)
     {
         lock (this.m_sync)
         {
             LSystem.isRunning = false;
             LSystem.isDestroy = true;
             if (LSystem.screenProcess != null)
             {
                 LSystem.screenProcess.OnDestroy();
                 ActionControl.GetInstance().StopAll();
             }
             XNAConfig.Dispose();
             if (fpsFont != null)
             {
                 fpsFont.Dispose();
                 fpsFont = null;
             }
         }
         Printf("finishApp");
     }
 }
Example #7
0
        public void ResetMessagePos()
        {
            int x = 0, y = 0;
            int len = message.Length;
            float mesWidth;
            int rightLimit = (int)(this.X() + GetWidth() - margin_right - fontSize);
            string[] line;
            char[] ch = new char[1];
            int count = 0;
            int baseX = 0, baseY = 0;
            LocatePoint lp;
            int locateCount = locatePoint.Count;
            int widthBuff;
            baseY = (int)(this.Y() + margin_top);
            baseX = (int)(this.X() + margin_left);
            switch (align)
            {
                case 'c': // 居中
                    line = StringUtils.Split(message, "\n");
                    y = baseY;
                    for (int j = 0; j < line.Length; j++)
                    {
                        len = line[j].Length;
                        mesWidth = (fontSize + pitch) * (len);
                        widthBuff = (int)((GetWidth() - margin_left - margin_right) / 2 - mesWidth / 2);
                        x = baseX + widthBuff;
                        for (int i = 0; i < len; i++)
                        {
                            ch[0] = line[j][i];
                            for (int k = 0; k < locateCount; k++)
                            {
                                lp = locatePoint[k];
                                if (count == lp.point)
                                {
                                    if (lp.x != 0)
                                        x = baseX + lp.x + widthBuff;
                                    if (lp.y != 0)
                                        y = baseY + lp.y;
                                }
                            }
                            message_x[count] = x;
                            message_y[count] = y;
                            count++;
                            x += (int)(fontSize + pitch);
                        }
                        if (isHch)
                        {
                            flag.SetPos((int)(y - flag.height), x);
                        }
                        else
                        {
                            flag.SetPos(x, (int)(y - flag.height));
                        }
                        y += linesize + linespacing;
                    }
                    break;

                case 'r': // 右对齐
                    line = StringUtils.Split(message, "\n");
                    y = baseY;
                    for (int j = 0; j < line.Length; j++)
                    {
                        len = line[j].Length;
                        mesWidth = (fontSize + pitch) * len;
                        widthBuff = (int)((GetWidth() - margin_left - margin_right) - mesWidth);
                        x = baseX + widthBuff;
                        for (int i = 0; i < len; i++)
                        {
                            ch[0] = line[j][i];
                            for (int k = 0; k < locateCount; k++)
                            {
                                lp = locatePoint[k];
                                if (count == lp.point)
                                {
                                    if (lp.x != 0)
                                        x = baseX + lp.x + widthBuff;
                                    if (lp.y != 0)
                                        y = baseY + lp.y;
                                }
                            }
                            message_x[count] = x;
                            message_y[count] = y;
                            count++;
                            x += (int)(fontSize + pitch);
                        }
                        if (isHch)
                        {
                            flag.SetPos((int)(y - flag.height), x);
                        }
                        else
                        {
                            flag.SetPos(x, (int)(y - flag.height));
                        }
                        y += linesize + linespacing;
                    }
                    break;
                default: // 左对齐
                    line = StringUtils.Split(message, "\n");
                    y = baseY;
                    for (int j = 0; j < line.Length; j++)
                    {
                        len = line[j].Length;
                        x = baseX;
                        for (int i = 0; i < len; i++)
                        {
                            ch[0] = line[j][i];
                            if (autoreturn && x >= rightLimit)
                            {
                                y += linesize + linespacing;
                                x = baseX;
                            }
                            for (int k = 0; k < locateCount; k++)
                            {
                                lp = locatePoint[k];
                                if (count == lp.point)
                                {
                                    if (lp.x != 0)
                                        x = baseX + lp.x;
                                    if (lp.y != 0)
                                        y = baseY + lp.y;
                                }
                            }
                            message_x[count] = x;
                            message_y[count] = y;
                            if (count == indentPoint)
                            {
                                baseX = x;
                            }
                            count++;
                            x += (int)(fontSize + pitch);
                        }
                        y += linesize + linespacing;
                    }
                    if (autoreturn && x >= rightLimit)
                    {
                        y += linesize + linespacing;
                        x = baseX;
                    }
                    y -= linesize + linespacing;
                    if (isHch)
                    {
                        flag.SetPos((int)(y - flag.height), x);
                    }
                    else
                    {
                        flag.SetPos(x, (int)(y - flag.height));
                    }
                    break;
            }
            if (tmpMessage != null && !message.Equals(tmpMessage))
            {
                if (mesFont != null)
                {
                    lock (mesFont)
                    {
                        mesFont.Dispose();
                        mesFont = new LSTRFont(deffont, message);
                    }
                }
                else
                {
                    mesFont = new LSTRFont(deffont, message);
                }
            }
            this.isDirty = true;
        }
Example #8
0
 public static LSTRFont GetGLFont(LFont f)
 {
     if (lazyEnglish.Count > LSystem.DEFAULT_MAX_CACHE_SIZE)
     {
         ClearEnglishLazy();
     }
     string key = MakeLazyWestKey(f);
     LSTRFont font = (LSTRFont)CollectionUtils.Get(lazyEnglish, key);
     if (font == null)
     {
         font = new LSTRFont(f, true);
         CollectionUtils.Put(lazyEnglish, key, font);
     }
     return font;
 }
Example #9
0
		public void Dispose() {
			if (strings != null) {
				strings.Dispose();
				strings = null;
			}
		}