示例#1
0
        /// <summary>
        ///   Converts the object into an xml string.
        /// </summary>
        /// <returns>
        ///   Returns the object as an xml string.
        /// </returns>
        public override string ToString()
        {
            StringBuilder sb = new();

            sb.Append('<').Append(nameof(WindowSettings)).Append(' ')
            .Append(nameof(WindowMode)).Append("=\"").Append(WindowMode.ToString()).Append('\"');

            if (!Close)
            {
                sb.AppendLine().Append("                ")
                .Append(nameof(Close)).Append("=\"").Append(Close).Append('\"');
            }
            if (Resizable)
            {
                sb.AppendLine().Append("                ")
                .Append(nameof(Resizable)).Append("=\"").Append(Resizable).Append('\"');
            }
            if (TargetFps is not 60.0f)
            {
                sb.AppendLine().Append("                ")
                .Append(nameof(TargetFps)).Append("=\"").Append(TargetFps).Append('\"');
            }

            return(sb.AppendLine(">")
                   .AppendLine(Xml.ToString(Size, nameof(Size), 1))

                   .Append("</").Append(nameof(WindowSettings)).Append('>')
                   .ToString());
        }
示例#2
0
 private void Help_Click(object sender, RoutedEventArgs e)
 {
     // Displays a messagebox showing the application title and group members on separate lines with an 'OK' button
     MessageBox.Show("Movie Database:" + Environment.NewLine + Environment.NewLine +
                     "Group Members:" + Environment.NewLine +
                     "Oisin Cassidy B00714881" + Environment.NewLine +
                     "Matthew Osinski B00713853" + Environment.NewLine +
                     "Aoife Boyle B00529417" + Environment.NewLine +
                     "You are in " + mode.ToString() + " mode.", "Help", MessageBoxButton.OK, MessageBoxImage.Information);
 }
示例#3
0
 public override void Update(float dtime)
 {
     base.Update(dtime);
     Device9.Clear(SlimDX.Direct3D9.ClearFlags.Target | SlimDX.Direct3D9.ClearFlags.ZBuffer, new SlimDX.Color4(1, 0.2f, 0.2f, 0.2f), 1, 0);
     window.Text = WindowMode.ToString() +
                   " || DeviceWidth: " + Settings.Resolution.Width +
                   ", DeviceHeight: " + Settings.Resolution.Height +
                   ", WindowClientWidth: " + window.ClientRectangle.Width +
                   ", WindowClientHeight: " + window.ClientRectangle.Height +
                   ", WindowWidth: " + window.Width +
                   ", WindowHeight: " + window.Height;
 }
示例#4
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            bool b;

            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            XmlUtil.SetAttribute(node, "classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
            XmlUtil.SetAttribute(node, "width", this.Width);
            XmlUtil.SetAttribute(node, "height", this.Height);
            XmlUtil.SetAttribute(node, "align", "middle");
            if (!string.IsNullOrEmpty(PlayerDownloadUrl))
            {
                XmlUtil.SetAttribute(node, "codebase", PlayerDownloadUrl);
            }
            _resourceFiles = new List <WebResourceFile>();
            WebResourceFile wf;
            string          swf = string.Empty;

            if (!string.IsNullOrEmpty(_swfFile))
            {
                if (File.Exists(_swfFile))
                {
                    wf = new WebResourceFile(_swfFile, WebResourceFile.WEBFOLDER_Images, out b);
                    _resourceFiles.Add(wf);
                    if (b)
                    {
                        _swfFile = wf.ResourceFile;
                    }
                    swf = string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(_swfFile));
                }
            }
            string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "arrow.gif");

            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b));
            }
            btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "menusep.png");
            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b));
            }
            setParam(node, "movie", swf);
            //
            setParam(node, "quality", Quality.ToString());
            //
            setParam(node, "bgcolor", ObjectCreationCodeGen.GetColorString(this.BackColor));
            if (!Play)
            {
                setParam(node, "play", "false");
            }
            if (!Loop)
            {
                setParam(node, "loop", "false");
            }
            if (Menu)
            {
                setParam(node, "menu", "true");
            }
            if (PlayScale != EnumFlashScale.@default)
            {
                setParam(node, "scale", PlayScale.ToString());
            }
            if (Align != EnumFlashAlign.Default)
            {
                setParam(node, "salign", Align.ToString());
            }
            if (WindowMode != EnumFlashWindowMode.window)
            {
                setParam(node, "wmode", WindowMode.ToString());
            }
            if (!string.IsNullOrEmpty(BaseUrl))
            {
                setParam(node, "base", BaseUrl);
            }
            if (AllowFullScreen)
            {
                setParam(node, "allowFullScreen", "true");
            }
            if (FullScreenAspectRatio != EnumFlashFullScreenAspectRatio.Default)
            {
                setParam(node, "fullScreenAspectRatio", FullScreenAspectRatio.ToString());
            }
            //
            XmlNode embedNode = node.OwnerDocument.CreateElement("embed");

            node.AppendChild(embedNode);
            XmlUtil.SetNameAttribute(embedNode, this.CodeName);
            XmlUtil.SetAttribute(embedNode, "src", swf);
            XmlUtil.SetAttribute(embedNode, "width", this.Width);
            XmlUtil.SetAttribute(embedNode, "height", this.Height);
            XmlUtil.SetAttribute(embedNode, "bgcolor", ObjectCreationCodeGen.GetColorString(this.BackColor));
            XmlUtil.SetAttribute(embedNode, "quality", this.Quality);
            XmlUtil.SetAttribute(embedNode, "name", Path.GetFileName(swf));
            XmlUtil.SetAttribute(embedNode, "type", "application/x-shockwave-flash");
            XmlUtil.SetAttribute(embedNode, "PLUGINSPAGE", "http://www.macromedia.com/go/getflashplayer");
            if (!Play)
            {
                XmlUtil.SetAttribute(embedNode, "play", "false");
            }
            if (!Loop)
            {
                XmlUtil.SetAttribute(embedNode, "loop", "false");
            }
            if (Menu)
            {
                XmlUtil.SetAttribute(embedNode, "menu", "true");
            }
            if (PlayScale != EnumFlashScale.@default)
            {
                XmlUtil.SetAttribute(embedNode, "scale", PlayScale.ToString());
            }
            if (Align != EnumFlashAlign.Default)
            {
                XmlUtil.SetAttribute(embedNode, "salign", Align.ToString());
            }
            if (WindowMode != EnumFlashWindowMode.window)
            {
                XmlUtil.SetAttribute(embedNode, "wmode", WindowMode.ToString());
            }
            if (!string.IsNullOrEmpty(BaseUrl))
            {
                XmlUtil.SetAttribute(embedNode, "base", BaseUrl);
            }
            if (AllowFullScreen)
            {
                XmlUtil.SetAttribute(embedNode, "allowFullScreen", "true");
            }
            if (FullScreenAspectRatio != EnumFlashFullScreenAspectRatio.Default)
            {
                XmlUtil.SetAttribute(embedNode, "fullScreenAspectRatio", FullScreenAspectRatio.ToString());
            }

            StringBuilder style = new StringBuilder();

            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, style);
            WebPageCompilerUtility.CreateElementPosition(this, style, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, style, false);

            XmlUtil.SetAttribute(node, "style", style.ToString());
            //
        }
示例#5
0
        public static void OnGUI()
        {
            // Initialize icon list
            if (icons == null)
            {
                List <GUIContent> content = new List <GUIContent>();

                // Get all the stock icons
                foreach (GameDatabase.TextureInfo texInfo in GameDatabase.Instance.databaseTexture.Where(t => t.name.StartsWith("Squad/Contracts/Icons/")))
                {
                    string name = texInfo.name.Replace("Squad/Contracts/Icons/", "");
                    if (forbiddenIcons.Contains(name))
                    {
                        continue;
                    }

                    content.Add(new GUIContent(ContractDefs.sprites[name].texture, name));
                }

                // Get all the directories for custom icons
                ConfigNode[] iconConfig = GameDatabase.Instance.GetConfigNodes("WAYPOINT_MANAGER_ICONS");
                foreach (ConfigNode configNode in iconConfig)
                {
                    string dir = configNode.GetValue("url");
                    foreach (GameDatabase.TextureInfo texInfo in GameDatabase.Instance.databaseTexture.Where(t => t.name.StartsWith(dir)))
                    {
                        content.Add(new GUIContent(texInfo.texture, texInfo.name));
                    }
                }

                // Add custom icons
                foreach (string icon in customIcons)
                {
                    foreach (GameDatabase.TextureInfo texInfo in GameDatabase.Instance.databaseTexture)
                    {
                        if (texInfo.name == icon)
                        {
                            content.Add(new GUIContent(texInfo.texture, texInfo.name));
                            break;
                        }
                    }
                }

                icons = content.ToArray();
            }

            // Initialize color list
            if (colors == null)
            {
                List <GUIContent> content = new List <GUIContent>();

                foreach (int seed in seeds)
                {
                    Color     color   = SystemUtilities.RandomColor(seed, 1.0f, 1.0f, 1.0f);
                    Texture2D texture = new Texture2D(6, 12, TextureFormat.RGBA32, false);

                    Color[] pixels = new Color[6 * 16];
                    for (int i = 0; i < pixels.Length; i++)
                    {
                        pixels[i] = color;
                    }
                    texture.SetPixels(pixels);
                    texture.Compress(true);

                    content.Add(new GUIContent(texture));
                }

                colors = content.ToArray();

                // Set the styles used
                colorWheelStyle         = new GUIStyle(GUI.skin.label);
                colorWheelStyle.padding = new RectOffset(0, 0, 2, 2);
                colorWheelStyle.margin  = new RectOffset(0, -1, 0, 0);

                colorLabelStyle              = new GUIStyle(GUI.skin.label);
                colorLabelStyle.padding      = new RectOffset(0, 0, 0, 0);
                colorLabelStyle.margin       = new RectOffset(4, 4, 6, 6);
                colorLabelStyle.stretchWidth = true;
                colorLabelStyle.fixedHeight  = 12;

                disabledText = new GUIStyle(GUI.skin.textField);
                disabledText.normal.textColor = Color.gray;
            }

            if (WaypointManager.Instance != null && WaypointManager.Instance.visible)
            {
                if (windowMode != WindowMode.None && windowMode != WindowMode.Delete)
                {
                    wpWindowPos = GUILayout.Window(
                        typeof(WaypointManager).FullName.GetHashCode() + 2,
                        wpWindowPos,
                        WindowGUI,
                        windowMode.ToString() + " Waypoint",
                        GUILayout.Height(1), GUILayout.ExpandHeight(true));

                    // Add the close icon
                    if (GUI.Button(new Rect(wpWindowPos.xMax - 18, wpWindowPos.yMin + 2, 16, 16), Config.closeIcon, GUI.skin.label))
                    {
                        windowMode = WindowMode.None;
                    }

                    if (showIconPicker)
                    {
                        // Default iconPicker position
                        if (iconPickerPosition.xMin == iconPickerPosition.xMax)
                        {
                            iconPickerPosition = new Rect((Screen.width - ICON_PICKER_WIDTH) / 2.0f, wpWindowPos.yMax, ICON_PICKER_WIDTH, 1);
                        }

                        iconPickerPosition = GUILayout.Window(
                            typeof(WaypointManager).FullName.GetHashCode() + 3,
                            iconPickerPosition,
                            IconPickerGUI,
                            "Icon Selector");

                        // Add the close icon
                        if (GUI.Button(new Rect(iconPickerPosition.xMax - 18, iconPickerPosition.yMin + 2, 16, 16), Config.closeIcon, GUI.skin.label))
                        {
                            showIconPicker = false;
                        }
                    }

                    // Reset the position of the iconPicker window
                    if (!showIconPicker)
                    {
                        iconPickerPosition.xMax = iconPickerPosition.xMin;
                    }
                }
                else if (windowMode == WindowMode.Delete)
                {
                    rmWindowPos = GUILayout.Window(
                        typeof(WaypointManager).FullName.GetHashCode() + 2,
                        rmWindowPos,
                        DeleteGUI,
                        windowMode.ToString() + " Waypoint");

                    // Add the close icon
                    if (GUI.Button(new Rect(rmWindowPos.xMax - 18, rmWindowPos.yMin + 2, 16, 16), Config.closeIcon, GUI.skin.label))
                    {
                        windowMode = WindowMode.None;
                    }
                }

                if (showExportDialog)
                {
                    expWindowPos = GUILayout.Window(
                        typeof(WaypointManager).FullName.GetHashCode() + 3,
                        expWindowPos,
                        ExportGUI,
                        "Overwrite export file?");

                    // Add the close icon
                    if (GUI.Button(new Rect(expWindowPos.xMax - 18, expWindowPos.yMin + 2, 16, 16), Config.closeIcon, GUI.skin.label))
                    {
                        showExportDialog = false;
                    }
                }

                if (mapLocationMode)
                {
                    PlaceWaypointAtCursor();

                    // Lock the waypoint if the user clicks
                    if (Event.current.type == EventType.MouseUp && Event.current.button == 0)
                    {
                        mapLocationMode = false;
                    }
                }
            }
        }
示例#6
0
 // Returns full view name including namespace and suffix 'View'
 private string GetFullViewName(WindowMode mode)
 {
     return("Nameless.NumberConverter.Views." + mode.ToString() + "View");
 }