Beispiel #1
0
        internal pSprite(pTexture texture, FieldTypes field, OriginTypes origin, ClockTypes clocking, Vector2 position,
                         float depth, bool alwaysDraw, Color4 colour)
        {
            Field    = field;
            Origin   = origin;
            Clocking = clocking;

            Position = position;
            Colour   = colour;

            Scale      = Vector2.One;
            Rotation   = 0;
            DrawDepth  = depth;
            AlwaysDraw = alwaysDraw;

            if (!alwaysDraw)
            {
                Alpha = 0;
            }
            else
            {
                Alpha = 1;
            }

            Texture      = texture;
            UsesTextures = true;
        }
Beispiel #2
0
 internal pAnimation(Texture2D[] textures, FieldTypes fieldType, OriginTypes originType, ClockTypes clockType,
                     Vector2 startPosition, float drawDepth, bool alwaysDraw, Color colour, object tag)
     : base(textures[0], fieldType, originType, clockType, startPosition, drawDepth, alwaysDraw, colour, tag)
 {
     TextureArray = textures;
     TextureCount = textures.Length;
 }
Beispiel #3
0
        internal pSprite(Texture2D texture, FieldTypes fieldType, OriginTypes originType, ClockTypes clockType,
                         Vector2 startPosition, float drawDepth, bool alwaysDraw, Color colour, Object tag)
        {
            Type = SpriteTypes.Image;

            localTexture = texture;

            Disposable = false;

            SpriteEffect = SpriteEffects.None;

            OriginType = originType;

            UpdateTextureSize();
            UpdateTextureAlignment();

            Clock           = clockType;
            CurrentPosition = startPosition;
            StartPosition   = CurrentPosition;
            CurrentRotation = 0;
            CurrentScale    = 1;
            Depth           = drawDepth;
            AlwaysDraw      = alwaysDraw;
            Field           = fieldType;
            CurrentColour   = colour;
            StartColour     = colour;
            Tag             = tag;
        }
Beispiel #4
0
        internal EventSprite(string filename, Vector2 startPosition, OriginTypes origin, StoryLayer layer)
        {
            Texture2D texture = SpriteCache.GetTexture(BeatmapManager.Current.ContainingFolder + "\\" + filename);

            Sprite =
                new pSprite(texture, FieldTypes.GamefieldRatio, origin, ClockTypes.Audio, startPosition,
                            EventManager.GetIncreasingDrawDepth(layer), false, Color.White);
            Layer    = layer;
            Origin   = origin;
            Type     = EventTypes.Sprite;
            Filename = filename;
        }
        public TypeOfDiff DisplayNodeFiles(TreeListNode node, DiffFile currentDiffFile, ArchAngel.Providers.CodeProvider.CSharp.MapInfoType mapInfo, AutoMergeTypes autoMergeType, OriginTypes originType)
        {
            CurrentDiffFile = currentDiffFile;
            CurrentMapInfo = mapInfo;
            OriginType = originType;
            Type type = null;

            if (mapInfo.UserObject != null)
            {
                type = mapInfo.UserObject.GetType();
            }
            else if (mapInfo.TemplateObject != null)
            {
                type = mapInfo.TemplateObject.GetType();
            }
            else if (mapInfo.PrevGenObject != null)
            {
                type = mapInfo.PrevGenObject.GetType();
            }
            string userText = null;
            string templateText = null;
            string prevGenText = null;
            string mergedText = null;

            if (type == typeof(ArchAngel.Providers.CodeProvider.CSharp.Class) ||
                type == typeof(ArchAngel.Providers.CodeProvider.CSharp.Interface) ||
                type == typeof(ArchAngel.Providers.CodeProvider.CSharp.Namespace) ||
                type == typeof(ArchAngel.Providers.CodeProvider.CSharp.Struct))
            {
                userText = mapInfo.UserObject == null ? null : ((ArchAngel.Providers.CodeProvider.CSharp.Class)mapInfo.UserObject).ToString(false);
                templateText = mapInfo.TemplateObject == null ? null : ((ArchAngel.Providers.CodeProvider.CSharp.Class)mapInfo.TemplateObject).ToString(false);
                prevGenText = mapInfo.PrevGenObject == null ? null : ((ArchAngel.Providers.CodeProvider.CSharp.Class)mapInfo.PrevGenObject).ToString(false);
            }
            else
            {
                userText = mapInfo.UserObject == null ? null : mapInfo.UserObject.ToString();
                templateText = mapInfo.TemplateObject == null ? null : mapInfo.TemplateObject.ToString();
                prevGenText = mapInfo.PrevGenObject == null ? null : mapInfo.PrevGenObject.ToString();
            }
            if (mapInfo.Parent != null)
            {
                mergedText = mapInfo.Parent.ToString();
            }
            else if (mapInfo.MergedObject != null)
            {
                mergedText = mapInfo.MergedObject.ToString();
            }
            return DisplayNodeFiles(node, CurrentDiffFile, autoMergeType, userText, templateText, prevGenText, mergedText, mapInfo.DiffType, OriginType);
        }
        public bool CheckMessage(InputHeader message, OriginTypes origin)
        {
            bool result = true;

            //result &= this.Secured == null ? true : this.Secured == message.SecurityEnabled;

            //result &= this.Routed == null ? true : this.Routed == message.RoutingEnabled;

            result &= this.Endpoint == null ? true : this.Endpoint == message.EndPoint;

            result &= this.Origin == OriginTypes.Any ? true : this.Origin == origin;

            result &= this.OpCodeType == message.Content.OpCode.GetType();

            result &= this.OpCodes.Length == 0 ? true : this.OpCodes.Contains((byte)message.Content.OpCode);

            return(result);
        }
        public bool CheckMessage(InputHeader message, OriginTypes origin)
        {
            bool result = true;

            //result &= this.Secured == null ? true : this.Secured == message.SecurityEnabled;

            //result &= this.Routed == null ? true : this.Routed == message.RoutingEnabled;

            result &= this.Endpoint == null ? true : this.Endpoint == message.EndPoint;

            result &= this.Origin == OriginTypes.Any ? true : this.Origin == origin;

            result &= this.OpCodeType == message.Content.OpCode.GetType();

            result &= this.OpCodes.Length == 0 ? true : this.OpCodes.Contains((byte)message.Content.OpCode);

            return result;
        }
        internal EventAnimation(string filename, Vector2 startPosition, OriginTypes origin, StoryLayer layer, int frameCount, int frameDelay)
        {
            Texture2D[] textures = new Texture2D[frameCount];

            for (int i = 0; i < frameCount; i++)
            {
                textures[i] = SpriteCache.GetTexture(BeatmapManager.Current.ContainingFolder + "\\" + filename.Replace(".", i + "."));
            }

            Animation =
                new
                pAnimation(textures, FieldTypes.GamefieldRatio, origin, ClockTypes.Audio, startPosition,
                           EventManager.GetIncreasingDrawDepth(layer), false, Color.White, null);
            Sprite              = Animation;
            FrameDelay          = Math.Max(1, frameDelay);
            Animation.frameSkip = (int)Math.Round(0.06 * frameDelay);

            Layer    = layer;
            Origin   = origin;
            Type     = EventTypes.Animation;
            Filename = filename;
        }
Beispiel #9
0
 internal pSprite(Texture2D texture, FieldTypes fieldType, OriginTypes originType, ClockTypes clockType,
                  int startX,
                  int startY)
     : this(texture, fieldType, originType, clockType, new Vector2(startX, startY), 1, false, Color.White)
 {
 }
Beispiel #10
0
 internal pAnimation(Texture2D[] textures, FieldTypes fieldType, OriginTypes originType, ClockTypes clockType,
                     Vector2 startPosition, float drawDepth, bool alwaysDraw, Color colour)
     : this(textures, fieldType, originType, clockType, startPosition, drawDepth, alwaysDraw, colour, null)
 {
 }
 public TypeOfDiff DisplayNodeFiles(TreeListNode node, DiffFile currentDiffFile)
 {
     OriginType = OriginTypes.DiffFile;
     return DisplayNodeFiles(node, currentDiffFile, AutoMergeTypes.None, "", "", "", "", currentDiffFile.DiffType, OriginType);
 }
        public TypeOfDiff DisplayNodeFiles(TreeListNode node, DiffFile currentDiffFile, AutoMergeTypes autoMergeType, string userText, string templateText, string parentText, string mergedText, TypeOfDiff currentDiffType, OriginTypes originType)
        {
            OriginType = originType;
            CurrentDiffFile = currentDiffFile;
            CurrentDiffType = currentDiffType;
            BusyPopulatingEditor = true;

            if (node.Tag.GetType() == typeof(DiffFile) &&
                !((DiffFile)node.Tag).IsText)
            {
                ucBinaryFileViewer1.RootParent = SlyceMergeWorker.PreviousGenerationFolder;
                ucBinaryFileViewer1.RootTemplate = Controller.Instance.GetTempFilePathForComponent(ComponentKey.WorkbenchFileGenerator);
                ucBinaryFileViewer1.RootUser = Controller.Instance.ProjectSettings.ProjectPath;
                ucBinaryFileViewer1.DiffFile = (DiffFile)node.Tag;
                // Binary file
                ucBinaryFileViewer1.Visible = true;
                ucBinaryFileViewer1.Left = this.Left;
                ucBinaryFileViewer1.Width = this.ClientSize.Width;
                ucBinaryFileViewer1.Top = this.Top;
                ucBinaryFileViewer1.Height = this.ClientSize.Height;
                SetNavigationButtons();
                ShowBinaryFiles(node);
                return GetCurrentDiffStatus();
            }
            else
            {
                ucBinaryFileViewer1.Visible = false;
            }
            OrigianlLineSpan = null;
            bool filesTheSame = true;
            syntaxEditor1.ResetText();

            // Perform a 3-way diff on the file
            string parentFile = "";
            string userFile = "";
            string templateFile = "";
            string mergedFile = "";
            string fileBodyParent = null;
            string fileBodyUser = null;
            string fileBodyGenerated = null;

            if (OriginType == OriginTypes.DiffFile)
            {
                parentFile = Path.Combine(SlyceMergeWorker.PreviousGenerationFolder, ((DiffFile)node.Tag).RelativePath);
                userFile = Path.Combine(Controller.Instance.ProjectSettings.ProjectPath, ((DiffFile)node.Tag).RelativePath);
                templateFile = Path.Combine(Controller.Instance.GetTempFilePathForComponent(ComponentKey.WorkbenchFileGenerator), ((DiffFile)node.Tag).RelativePath);
                mergedFile = Path.Combine(SlyceMergeWorker.StagingFolder, ((DiffFile)node.Tag).RelativePath + ".merged");

                fileBodyParent = File.Exists(parentFile) ? IOUtility.GetTextFileBody(parentFile) : "";
                fileBodyUser = File.Exists(userFile) ? IOUtility.GetTextFileBody(userFile) : "";
                fileBodyGenerated = File.Exists(templateFile) ? IOUtility.GetTextFileBody(templateFile) : "";
            }
            else
            {
                fileBodyParent = parentText;
                fileBodyUser = userText;
                fileBodyGenerated = templateText;
            }
            fileBodyParent = Slyce.Common.Utility.StandardizeLineBreaks(fileBodyParent, Slyce.Common.Utility.LineBreaks.Unix);
            fileBodyUser = Slyce.Common.Utility.StandardizeLineBreaks(fileBodyUser, Slyce.Common.Utility.LineBreaks.Unix);
            fileBodyGenerated = Slyce.Common.Utility.StandardizeLineBreaks(fileBodyGenerated, Slyce.Common.Utility.LineBreaks.Unix);
            DetermineFileType(node);

            if (CurrentDiffType == TypeOfDiff.UserChangeOnly)
            {
                MarginTextUser = "******";
                Slyce.IntelliMerge.UI.Utility.Perform2WayDiffInSingleEditor(syntaxEditor1, ref fileBodyUser, ref fileBodyParent, true);
                syntaxEditor1.Document.ReadOnly = true;
                toolStripButtonAcceptTemplateChanges.Enabled = false;
                toolStripButtonAcceptUserChanges.Enabled = false;
                this.Text = "View only - No conflicts";
                buttonClose.Text = "&Close";
                buttonSave.Visible = false;
                SetNavigationButtons();
                this.ShowDialog(Controller.Instance.MainForm);
                return CurrentDiffType;
            }
            else if (CurrentDiffType == TypeOfDiff.TemplateChangeOnly)
            {
                MarginTextUser = "******";

                if (fileBodyGenerated == null)
                {
                    // This is marked as a TemplateChange because the template DELETED the corresponding entity
                    DisplayingTextMessage = true;
                    toolStripComboBoxFileType.Text = Slyce.Common.SyntaxEditorHelper.LanguageNameFromEnum(Slyce.Common.SyntaxEditorHelper.Languages.PlainText);
                    syntaxEditor1.WordWrap = ActiproSoftware.SyntaxEditor.WordWrapType.Word;
                    syntaxEditor1.Text = "This is a TemplateChange because it looks like the Template has not created the corresponding entity. In effect, the template has DELETED the corresponding entity. Alternatively, the corresponding entity has been RENAMED, or it's namespace has been renamed. If this is the case, click 'Select Match' on the popup menu to locate a renamed version of this entity if the template has renamed it (or its namespace).";
                }
                else
                {
                    Slyce.IntelliMerge.UI.Utility.Perform2WayDiffInSingleEditor(syntaxEditor1, ref fileBodyGenerated, ref fileBodyParent, true);
                }
                syntaxEditor1.Document.ReadOnly = true;
                toolStripButtonAcceptTemplateChanges.Enabled = false;
                toolStripButtonAcceptUserChanges.Enabled = false;
                this.Text = "View only - No conflicts";
                buttonClose.Text = "&Close";
                buttonSave.Visible = false;
                SetNavigationButtons();
                this.ShowDialog(Controller.Instance.MainForm);
                return CurrentDiffType;
            }
            else if (CurrentDiffType == TypeOfDiff.UserAndTemplateChange)
            {
                if (OriginType == OriginTypes.DiffFile)
                {
                    string mergedFileName = mergedFile.Replace(".merged", ".copy");

                    if (!File.Exists(mergedFileName))
                    {
                        throw new Exception("Merged file with user and template changes not found.");
                    }
                    mergedText = IOUtility.GetTextFileBody(mergedFileName);
                    mergedText = Slyce.Common.Utility.StandardizeLineBreaks(mergedText, Slyce.Common.Utility.LineBreaks.Unix);
                }
                SlyceMerge.LineSpan[] userLines;
                SlyceMerge.LineSpan[] templateLines;
                SlyceMerge.LineSpan[] rightLinesUser;
                SlyceMerge.LineSpan[] rightLinesTemplate;
                string combinedText;
                SlyceMerge.PerformTwoWayDiff(false, mergedText, fileBodyUser, out userLines, out rightLinesUser, out combinedText);
                SlyceMerge.PerformTwoWayDiff(false, mergedText, fileBodyGenerated, out templateLines, out rightLinesTemplate, out combinedText);
                syntaxEditor1.Text = mergedText;

                for (int i = 0; i < userLines.Length; i++)
                {
                    #region Get offset
                    int offsetUser = 0;

                    for (int counterRightLineUser = 0; counterRightLineUser < rightLinesUser.Length; counterRightLineUser++)
                    {
                        if (rightLinesUser[counterRightLineUser].StartLine < userLines[i].StartLine)
                        {
                            offsetUser += (rightLinesUser[counterRightLineUser].EndLine - rightLinesUser[counterRightLineUser].StartLine + 1);
                        }
                        else
                        {
                            break;
                        }

                    }
                    #endregion

                    for (int lineCounter = userLines[i].StartLine; lineCounter <= userLines[i].EndLine; lineCounter++)
                    {
                        syntaxEditor1.Document.Lines[lineCounter - offsetUser].BackColor = Slyce.IntelliMerge.UI.Utility.ColourNewGen;
                    }
                }
                for (int i = 0; i < templateLines.Length; i++)
                {
                    #region Get offset
                    int offsetTemplate = 0;

                    for (int counterRightLineTemplate = 0; counterRightLineTemplate < rightLinesTemplate.Length; counterRightLineTemplate++)
                    {
                        if (rightLinesTemplate[counterRightLineTemplate].StartLine < templateLines[i].StartLine)
                        {
                            offsetTemplate += (rightLinesTemplate[counterRightLineTemplate].EndLine - rightLinesTemplate[counterRightLineTemplate].StartLine + 1);
                        }
                        else
                        {
                            break;
                        }
                    }
                    #endregion

                    for (int lineCounter = templateLines[i].StartLine; lineCounter <= templateLines[i].EndLine; lineCounter++)
                    {
                        syntaxEditor1.Document.Lines[lineCounter - offsetTemplate].BackColor = Slyce.IntelliMerge.UI.Utility.ColourUser;
                    }
                }
                syntaxEditor1.Document.ReadOnly = true;
                toolStripButtonAcceptTemplateChanges.Enabled = false;
                toolStripButtonAcceptUserChanges.Enabled = false;
                this.Text = "View only - No conflicts";
                buttonClose.Text = "&Close";
                buttonSave.Visible = false;
                SetNavigationButtons();
                this.ShowDialog(Controller.Instance.MainForm);
                return currentDiffFile.DiffType;
            }
            syntaxEditor1.SuspendPainting();

            if (File.Exists(mergedFile))
            {
                using (TextReader tr = new StreamReader(mergedFile))
                {
                    string line = "";
                    int lineCounter = 0;
                    int pipeIndex = 0;
                    int backColor = 0;

                    while ((line = tr.ReadLine()) != null)
                    {
                        pipeIndex = line.IndexOf("|");
                        backColor = int.Parse(line.Substring(0, pipeIndex));
                        syntaxEditor1.Document.AppendText(line.Substring(pipeIndex + 1) + Environment.NewLine);
                        syntaxEditor1.Document.Lines[lineCounter].BackColor = Color.FromArgb(backColor);
                        lineCounter++;
                    }
                }
            }
            else // A merged file hasn't been created yet, so conflicts still exist
            {
                if (fileBodyParent != null &&
                          fileBodyUser != null &&
                          fileBodyGenerated != null)
                {
                    // Perform 3-way diff
                    string output;
                    SlyceMerge slyceMerge = SlyceMerge.Perform3wayDiff(fileBodyUser, fileBodyParent, fileBodyGenerated, out output);
                    int lineCounter = 0;
                    StringBuilder sb = new StringBuilder(Math.Max(fileBodyUser.Length, Math.Max(fileBodyParent.Length, fileBodyGenerated.Length)) + 1000);
                    System.Collections.ArrayList colouredLines = new System.Collections.ArrayList();

                    foreach (SlyceMerge.LineText line in slyceMerge.Lines)
                    {
                        int charPos = 0;
                        int numLineBreaks = 0;
                        charPos = line.Text.IndexOf("\r", 0);

                        if (charPos < 0) { numLineBreaks++; }

                        while (charPos >= 0)
                        {
                            numLineBreaks++;
                            charPos = line.Text.IndexOf("\r", charPos + 1);
                        }
                        sb.AppendLine(line.Text.Replace("\r", ""));
                        colouredLines.Add(new SlyceMerge.LineSpan(lineCounter, lineCounter + numLineBreaks, line.Colour));
                        lineCounter += numLineBreaks;
                    }
                    int linesToRemove = 0;
                    string text = sb.ToString();
                    string lastChar = text.Substring(text.Length - linesToRemove - 1);

                    while (lastChar.Length == 0 ||
                        lastChar == "\n" ||
                        lastChar == "\r" &&
                        text.Length >= linesToRemove + 1)
                    {
                        linesToRemove++;
                        lastChar = text.Substring(text.Length - linesToRemove - 1, 1);
                    }
                    syntaxEditor1.Document.Text = text.Substring(0, text.Length - linesToRemove);

                    for (int i = 0; i < colouredLines.Count; i++)
                    {
                        SlyceMerge.LineSpan ls = (SlyceMerge.LineSpan)colouredLines[i];

                        if (ls.OriginalColor != Color.White) { filesTheSame = false; }

                        for (int x = ls.StartLine; x <= ls.EndLine; x++)
                        {
                            if (x >= syntaxEditor1.Document.Lines.Count)
                            {
                                break;
                            }
                            syntaxEditor1.Document.Lines[x].BackColor = ls.OriginalColor;
                        }
                    }
                    if (filesTheSame)
                    {
                        this.Text = "No Changes";
                    }
                }
                else if (fileBodyParent != null &&
                          fileBodyUser != null &&
                          fileBodyGenerated == null)
                {
                    // No template file, just use the user file
                    syntaxEditor1.Text = fileBodyUser;
                    this.Text = "No Conflicts";
                }
                else if (fileBodyParent != null &&
             fileBodyUser == null &&
            fileBodyGenerated != null)
                {
                    // No user file, just use the template file
                    Slyce.IntelliMerge.UI.Utility.Perform2WayDiffInSingleEditor(syntaxEditor1, ref fileBodyGenerated, ref fileBodyParent, true);
                }
                else if (fileBodyParent == null &&
                       fileBodyUser != null &&
                  fileBodyGenerated != null)
                {
                    // No parent file, make sure the user merges the template and user files
                    string combinedText;
                    Slyce.IntelliMerge.SlyceMerge.LineSpan[] userLines;
                    Slyce.IntelliMerge.SlyceMerge.LineSpan[] templateLines;
                    SlyceMerge.PerformTwoWayDiff(false, fileBodyUser, fileBodyGenerated, out userLines, out templateLines, out combinedText);
                    Slyce.IntelliMerge.UI.Utility.PopulateSyntaxEditor(syntaxEditor1, combinedText, userLines, templateLines);
                    this.Text = "User changes vs generated";
                }
                else
                {
                    if (fileBodyParent != null)
                    {
                        if (File.Exists(userFile) || File.Exists(templateFile))
                        {
                            throw new Exception("More than one file exists. Shouldn't be here.");
                        }
                        syntaxEditor1.Text = fileBodyParent;
                        this.Text = "Unchanged file";
                    }
                    else if (fileBodyUser != null)
                    {
                        if (File.Exists(parentFile) || File.Exists(templateFile))
                        {
                            throw new Exception("More than one file exists. Shouldn't be here.");
                        }
                        syntaxEditor1.Text = fileBodyUser;
                        this.Text = "User-only file";
                    }
                    else if (fileBodyGenerated != null)
                    {
                        if (File.Exists(parentFile) || File.Exists(userFile))
                        {
                            throw new Exception("More than one file exists. Shouldn't be here.");
                        }
                        syntaxEditor1.Text = fileBodyGenerated;
                        this.Text = "Newly Generated file";
                    }
                }
            }
            syntaxEditor1.Refresh();

            if (syntaxEditor1.Document.Text.Length > 0)
            {
                syntaxEditor1.SelectedView.Selection.StartOffset = 0;
                syntaxEditor1.SelectedView.Selection.EndOffset = 0;
            }
            syntaxEditor1.Document.Modified = false;
            syntaxEditor1.ResumePainting();
            BusyPopulatingEditor = false;

            switch (autoMergeType)
            {
                case AutoMergeTypes.None:
                    GotoNextConflictLine(0);
                    this.ShowDialog(Controller.Instance.MainForm);
                    break;
                case AutoMergeTypes.KeepUserChanges:
                    AcceptAllUserChanges();

                    if (!SaveCurrentFile(false))
                    {
                        MessageBox.Show("There was a problem processing this file automatically. Please resolve these changes manually.", "Auto Processing Problem", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        GotoNextConflictLine(0);
                        this.ShowDialog(Controller.Instance.MainForm);
                    }
                    break;
                case AutoMergeTypes.KeepTemplateChanges:
                    AcceptAllTemplateChanges();

                    if (!SaveCurrentFile(false))
                    {
                        MessageBox.Show("There was a problem processing this file automatically. Please resolve these changes manually.", "Auto Processing Problem", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        GotoNextConflictLine(0);
                        this.ShowDialog(Controller.Instance.MainForm);
                    }
                    break;
            }
            SetNavigationButtons();
            if (CancelClicked) { return TypeOfDiff.Conflict; }
            else { return GetCurrentDiffStatus(); }
        }
Beispiel #13
0
 internal pSprite(Texture2D texture, FieldTypes fieldType, OriginTypes originType, ClockTypes clockType,
                  Vector2 position)
     : this(texture, fieldType, originType, clockType, position, 1, false, Color.White)
 {
 }
Beispiel #14
0
 internal pSpriteText(string text, string fontname, int spacingOverlap, FieldTypes fieldType, OriginTypes originType, ClockTypes clockType,
                      Vector2 startPosition, float drawDepth, bool alwaysDraw, Color colour)
     : base(null, fieldType, originType, clockType, startPosition, drawDepth, alwaysDraw, colour)
 {
     Text           = text;
     localTexture   = null;
     textChanged    = true;
     Type           = SpriteTypes.SpriteText;
     TextFont       = fontname;
     SpacingOverlap = spacingOverlap;
 }
Beispiel #15
0
        public override void Initialize()
        {
            base.Initialize();

            FromBottom = false; // GameBase.Instance.FlipView;

            FieldTypes  field  = FromBottom ? FieldTypes.StandardSnapBottomCentre : FieldTypes.StandardSnapTopCentre;
            OriginTypes origin = FromBottom ? OriginTypes.BottomCentre : OriginTypes.TopCentre;

            background          = new pSprite(TextureManager.Load(OsuTexture.play_menu_background), field, OriginTypes.TopCentre, ClockTypes.Mode, new Vector2(0, offscreen_y), 0.8f, true, Color4.White);
            background.Rotation = FromBottom ? (float)Math.PI : 0;
            spriteManager.Add(background);

            /*if (Director.LastOsuMode != OsuMode.Play)
             * {
             *  pullnotice = new pSprite(TextureManager.Load(OsuTexture.play_menu_pull), field, origin, ClockTypes.Mode, Vector2.Zero, 0.9f, false, Color4.White);
             *  pullnotice.DrawHeight = 87;
             *
             *  if (!FromBottom) pullnotice.DrawTop += 26;
             *  pullnotice.Offset = new Vector2(0, 30);
             *  spriteManager.Add(pullnotice);
             *
             *  Transformation move = new TransformationF(TransformationType.MovementY, 0f, offscreen_y, 1000, 1500, EasingTypes.Out);
             *  Transformation fade = new TransformationF(TransformationType.Fade, 1, 0.4f, 1000, 1500);
             *
             *  spriteManager.Sprites.ForEach(s =>
             *  {
             *      s.Transform(move);
             *      s.Transform(fade);
             *  });
             * }
             * else
             * {
             *  background.Position.Y = offscreen_y;
             * }*/

            buttonContinue = new pSprite(TextureManager.Load(OsuTexture.play_menu_continue), field, origin, ClockTypes.Mode, Vector2.Zero, 0.85f, true, colourInactive)
            {
                Alpha = 0, Offset = new Vector2(-210, 3)
            };
            buttonContinue.OnClick     += ButtonContinue_OnClick;
            buttonContinue.OnHover     += HandleButtonHover;
            buttonContinue.OnHoverLost += HandleButtonHoverLost;
            spriteManager.Add(buttonContinue);

            buttonRestart = new pSprite(TextureManager.Load(OsuTexture.play_menu_restart), field, origin, ClockTypes.Mode, Vector2.Zero, 0.85f, true, colourInactive)
            {
                Alpha = 0, Offset = new Vector2(0, 3)
            };
            buttonRestart.OnClick     += ButtonRestart_OnClick;
            buttonRestart.OnHover     += HandleButtonHover;
            buttonRestart.OnHoverLost += HandleButtonHoverLost;
            spriteManager.Add(buttonRestart);

            buttonQuit = new pSprite(TextureManager.Load(OsuTexture.play_menu_quit), field, origin, ClockTypes.Mode, Vector2.Zero, 0.85f, true, colourInactive)
            {
                Alpha = 0, Offset = new Vector2(210, 3)
            };
            buttonQuit.OnClick     += ButtonQuit_OnClick;
            buttonQuit.OnHover     += HandleButtonHover;
            buttonQuit.OnHoverLost += HandleButtonHoverLost;
            spriteManager.Add(buttonQuit);
        }
Beispiel #16
0
 internal pSpriteRenderer(pTexture texture, FieldTypes field, OriginTypes origin, ClockTypes clocking, Vector2 position,
                          float depth, bool alwaysDraw, Color4 colour)
     : base(texture, field, origin, clocking, position, depth, alwaysDraw, colour)
 {
 }
Beispiel #17
0
 internal pSprite(string pngFilename, FieldTypes fieldType, OriginTypes originType, ClockTypes clockType,
                  Vector2 startPosition, float drawDepth, bool alwaysDraw, Color colour, Object tag)
     : this(SpriteCache.GetTexture(pngFilename),
            fieldType, originType, clockType, startPosition, drawDepth, alwaysDraw, colour, tag)
 {
 }
Beispiel #18
0
 internal pSprite(Texture2D texture, OriginTypes originType, Vector2 startPosition, float drawDepth, bool alwaysDraw, Color colour)
     : this(texture, FieldTypes.Window, originType, ClockTypes.Game, startPosition, drawDepth, alwaysDraw, colour, null)
 {
 }