Ejemplo n.º 1
0
 public override void Dispose()
 {
     if (!IsDisposed)
     {
         m_castleGate     = null;
         m_teleporter     = null;
         m_bossDoor       = null;
         m_bossDoorSprite = null;
         m_diary          = null;
         m_speechBubble   = null;
         m_mapText        = null;
         m_mapIcon        = null;
         base.Dispose();
     }
 }
Ejemplo n.º 2
0
 public string AddKeyIcon(string text, int startIndex, int endIndex)
 {
     KeyIconObj keyIconObj = new KeyIconObj();
     Vector2 arg_0B_0 = Vector2.Zero;
     string text2 = text.Substring(startIndex, endIndex - startIndex + 1);
     string oldValue = text2;
     if (text2.Contains("Input"))
     {
         string text3 = text2.Replace("[Input:", "");
         text3 = text3.Replace("]", "");
         byte index = byte.Parse(text3);
         if (InputManager.GamePadIsConnected(PlayerIndex.One))
         {
             Buttons buttons = Game.GlobalInput.ButtonList[(int)index];
             text2 = text2.Replace(text3, buttons.ToString());
             text2 = text2.Replace("Input", "Button");
         }
         else
         {
             Keys keys = Game.GlobalInput.KeyList[(int)index];
             text2 = text2.Replace(text3, keys.ToString());
             text2 = text2.Replace("Input", "Key");
         }
     }
     if (text2.Contains("Key"))
     {
         string text4 = text2.Replace("[Key:", "");
         text4 = text4.Replace("]", "");
         bool upperCase = true;
         if (text4 == "Enter" || text4 == "Space")
         {
             upperCase = false;
         }
         keyIconObj.SetKey(new Keys?((Keys)Enum.Parse(typeof(Keys), text4)), upperCase);
         float y = (base.Font.MeasureString("0") * this.m_internalFontSizeScale * this.Scale).Y;
         keyIconObj.Scale = new Vector2(y / (float)keyIconObj.Height, y / (float)keyIconObj.Height) * this.ForcedScale;
         this.m_yOffset = y / 2f;
         string text5 = " ";
         while (base.Font.MeasureString(text5).X * this.m_internalFontSizeScale.X * this.Scale.X < (float)keyIconObj.Width)
         {
             text5 += " ";
         }
         string text6 = text.Substring(0, text.IndexOf("["));
         text = text.Replace(oldValue, text5);
         float num = base.Font.MeasureString(text5).X * this.m_internalFontSizeScale.X * this.Scale.X;
         num /= 2f;
         float num2 = base.Font.MeasureString(text6).X * this.m_internalFontSizeScale.X * this.Scale.X;
         float item = num2 + num;
         this.m_iconOffset.Add(item);
     }
     else
     {
         string text7 = text2.Replace("[Button:", "");
         text7 = text7.Replace("]", "");
         keyIconObj.SetButton((Buttons)Enum.Parse(typeof(Buttons), text7));
         float y2 = (base.Font.MeasureString("0") * this.m_internalFontSizeScale * this.Scale).Y;
         keyIconObj.Scale = new Vector2(y2 / (float)keyIconObj.Height, y2 / (float)keyIconObj.Height) * this.ForcedScale;
         this.m_yOffset = y2 / 2f;
         string text8 = " ";
         while (base.Font.MeasureString(text8).X * this.m_internalFontSizeScale.X * this.Scale.X < (float)keyIconObj.Width)
         {
             text8 += " ";
         }
         string text9 = text.Substring(0, text.IndexOf("["));
         text = text.Replace(oldValue, text8);
         float num3 = base.Font.MeasureString(text8).X * this.m_internalFontSizeScale.X * this.Scale.X;
         num3 /= 2f;
         float num4 = base.Font.MeasureString(text9).X * this.m_internalFontSizeScale.X * this.Scale.X;
         float item2 = num4 + num3;
         this.m_iconOffset.Add(item2);
     }
     this.m_iconList.Add(keyIconObj);
     return text;
 }
Ejemplo n.º 3
0
 public override void Dispose()
 {
     if (!base.IsDisposed)
     {
         this.m_castleGate = null;
         this.m_teleporter = null;
         this.m_bossDoor = null;
         this.m_bossDoorSprite = null;
         this.m_diary = null;
         this.m_speechBubble = null;
         this.m_mapText = null;
         this.m_mapIcon = null;
         base.Dispose();
     }
 }
Ejemplo n.º 4
0
 public override void Initialize()
 {
     this.m_speechBubble = new SpriteObj("ExclamationSquare_Sprite");
     this.m_speechBubble.Flip = SpriteEffects.FlipHorizontally;
     this.m_speechBubble.Scale = new Vector2(1.2f, 1.2f);
     base.GameObjList.Add(this.m_speechBubble);
     this.m_mapText = new KeyIconTextObj(Game.JunicodeFont);
     this.m_mapText.Text = "view map any time";
     this.m_mapText.Align = Types.TextAlign.Centre;
     this.m_mapText.FontSize = 12f;
     this.m_mapText.OutlineWidth = 2;
     base.GameObjList.Add(this.m_mapText);
     this.m_mapIcon = new KeyIconObj();
     this.m_mapIcon.Scale = new Vector2(0.5f, 0.5f);
     base.GameObjList.Add(this.m_mapIcon);
     foreach (GameObj current in base.GameObjList)
     {
         if (current.Name == "diary")
         {
             this.m_diary = (current as SpriteObj);
         }
         if (current.Name == "map")
         {
             (current as SpriteObj).OutlineWidth = 2;
             this.m_mapText.Position = new Vector2(current.X, (float)(current.Bounds.Top - 50));
             this.m_mapIcon.Position = new Vector2(this.m_mapText.X, this.m_mapText.Y - 20f);
         }
     }
     this.m_diary.OutlineWidth = 2;
     this.m_speechBubble.Position = new Vector2(this.m_diary.X, this.m_diary.Y - (float)this.m_speechBubble.Height - 20f);
     DoorObj doorObj = null;
     foreach (GameObj current2 in base.GameObjList)
     {
         if (current2.Name == "LastDoor")
         {
             this.m_bossDoorSprite = (current2 as ObjContainer);
             break;
         }
     }
     foreach (DoorObj current3 in base.DoorList)
     {
         if (current3.DoorPosition == "Left")
         {
             doorObj = current3;
         }
         if (current3.IsBossDoor)
         {
             this.m_bossDoor = current3;
             this.m_bossDoor.Locked = true;
         }
     }
     for (int i = 1; i < this.m_bossDoorSprite.NumChildren; i++)
     {
         this.m_bossDoorSprite.GetChildAt(i).Opacity = 0f;
     }
     this.m_bossDoorSprite.AnimationDelay = 0.1f;
     this.m_castleGate.Position = new Vector2((float)(doorObj.Bounds.Right - this.m_castleGate.Width), doorObj.Y - (float)this.m_castleGate.Height);
     this.m_teleporter.Position = new Vector2(base.X + (float)this.Width / 2f - 600f, base.Y + 720f - 120f);
     base.Initialize();
 }
Ejemplo n.º 5
0
        public override void Initialize()
        {
            m_speechBubble       = new SpriteObj("ExclamationSquare_Sprite");
            m_speechBubble.Flip  = SpriteEffects.FlipHorizontally;
            m_speechBubble.Scale = new Vector2(1.2f, 1.2f);
            GameObjList.Add(m_speechBubble);
            m_mapText              = new KeyIconTextObj(Game.JunicodeFont);
            m_mapText.Text         = "view map any time";
            m_mapText.Align        = Types.TextAlign.Centre;
            m_mapText.FontSize     = 12f;
            m_mapText.OutlineWidth = 2;
            GameObjList.Add(m_mapText);
            m_mapIcon       = new KeyIconObj();
            m_mapIcon.Scale = new Vector2(0.5f, 0.5f);
            GameObjList.Add(m_mapIcon);
            foreach (var current in GameObjList)
            {
                if (current.Name == "diary")
                {
                    m_diary = (current as SpriteObj);
                }
                if (current.Name == "map")
                {
                    (current as SpriteObj).OutlineWidth = 2;
                    m_mapText.Position = new Vector2(current.X, current.Bounds.Top - 50);
                    m_mapIcon.Position = new Vector2(m_mapText.X, m_mapText.Y - 20f);
                }
            }
            m_diary.OutlineWidth    = 2;
            m_speechBubble.Position = new Vector2(m_diary.X, m_diary.Y - m_speechBubble.Height - 20f);
            DoorObj doorObj = null;

            foreach (var current2 in GameObjList)
            {
                if (current2.Name == "LastDoor")
                {
                    m_bossDoorSprite = (current2 as ObjContainer);
                    break;
                }
            }
            foreach (var current3 in DoorList)
            {
                if (current3.DoorPosition == "Left")
                {
                    doorObj = current3;
                }
                if (current3.IsBossDoor)
                {
                    m_bossDoor        = current3;
                    m_bossDoor.Locked = true;
                }
            }
            for (var i = 1; i < m_bossDoorSprite.NumChildren; i++)
            {
                m_bossDoorSprite.GetChildAt(i).Opacity = 0f;
            }
            m_bossDoorSprite.AnimationDelay = 0.1f;
            m_castleGate.Position           = new Vector2(doorObj.Bounds.Right - m_castleGate.Width,
                                                          doorObj.Y - m_castleGate.Height);
            m_teleporter.Position = new Vector2(X + Width / 2f - 600f, Y + 720f - 120f);
            base.Initialize();
        }
Ejemplo n.º 6
0
        public string AddKeyIcon(string text, int startIndex, int endIndex)
        {
            var keyIconObj = new KeyIconObj();
            var arg_0B_0   = Vector2.Zero;
            var text2      = text.Substring(startIndex, endIndex - startIndex + 1);
            var oldValue   = text2;

            if (text2.Contains("Input"))
            {
                var text3 = text2.Replace("[Input:", "");
                text3 = text3.Replace("]", "");
                var index = byte.Parse(text3);
                if (InputManager.GamePadIsConnected(PlayerIndex.One))
                {
                    var buttons = Game.GlobalInput.ButtonList[index];
                    text2 = text2.Replace(text3, buttons.ToString());
                    text2 = text2.Replace("Input", "Button");
                }
                else
                {
                    var keys = Game.GlobalInput.KeyList[index];
                    text2 = text2.Replace(text3, keys.ToString());
                    text2 = text2.Replace("Input", "Key");
                }
            }
            if (text2.Contains("Key"))
            {
                var text4 = text2.Replace("[Key:", "");
                text4 = text4.Replace("]", "");
                var upperCase = true;
                if (text4 == "Enter" || text4 == "Space")
                {
                    upperCase = false;
                }
                keyIconObj.SetKey((Keys)Enum.Parse(typeof(Keys), text4), upperCase);
                var y = (Font.MeasureString("0") * m_internalFontSizeScale * Scale).Y;
                keyIconObj.Scale = new Vector2(y / keyIconObj.Height, y / keyIconObj.Height) * ForcedScale;
                m_yOffset        = y / 2f;
                var text5 = " ";
                while (Font.MeasureString(text5).X *m_internalFontSizeScale.X *Scale.X < keyIconObj.Width)
                {
                    text5 += " ";
                }
                var text6 = text.Substring(0, text.IndexOf("["));
                text = text.Replace(oldValue, text5);
                var num = Font.MeasureString(text5).X *m_internalFontSizeScale.X *Scale.X;
                num /= 2f;
                var num2 = Font.MeasureString(text6).X *m_internalFontSizeScale.X *Scale.X;
                var item = num2 + num;
                m_iconOffset.Add(item);
            }
            else
            {
                var text7 = text2.Replace("[Button:", "");
                text7 = text7.Replace("]", "");
                keyIconObj.SetButton((Buttons)Enum.Parse(typeof(Buttons), text7));
                var y2 = (Font.MeasureString("0") * m_internalFontSizeScale * Scale).Y;
                keyIconObj.Scale = new Vector2(y2 / keyIconObj.Height, y2 / keyIconObj.Height) * ForcedScale;
                m_yOffset        = y2 / 2f;
                var text8 = " ";
                while (Font.MeasureString(text8).X *m_internalFontSizeScale.X *Scale.X < keyIconObj.Width)
                {
                    text8 += " ";
                }
                var text9 = text.Substring(0, text.IndexOf("["));
                text = text.Replace(oldValue, text8);
                var num3 = Font.MeasureString(text8).X *m_internalFontSizeScale.X *Scale.X;
                num3 /= 2f;
                var num4  = Font.MeasureString(text9).X *m_internalFontSizeScale.X *Scale.X;
                var item2 = num4 + num3;
                m_iconOffset.Add(item2);
            }
            m_iconList.Add(keyIconObj);
            return(text);
        }