예제 #1
0
        protected override void OnEnable()
        {
            string[] allImages = System.IO.Directory.GetFiles(Directory);
            if (allImages.Length == 0)
            {
                texture = new Texture2D(1, 1, TextureFormat.RGBA32, false);
                texture.SetPixel(0, 0, new Color(0f, 36f / 255f, 36f / 255f, 1f));
                texture.Apply();
                return;
            }
            var random = allImages[UnityEngine.Random.Range(0, allImages.Length)].Substring(Directory.Length);

            if (random.EndsWith(".ogv"))
            {
                movie = LoadVideo(random);
                if (movie != null)
                {
                    movie.loop = true;
                    movie.Play();
                }
            }
            else
            {
                texture = LoadTexture(random, "");
            }
            screenRect     = new Rect(0f, 0f, Style.ScreenWidth, Style.ScreenHeight);
            style          = Helper.CreateStyle(TextAnchor.LowerCenter, FontStyle.Bold, 25, false, new Color(0.95f, 0.95f, 0.95f));
            style.richText = true;
            style.font     = AnarchyAssets.Load <Font>(Style.FontName);
            AnarchyManager.MainMenu.Enable();
        }
예제 #2
0
 public static void Load()
 {
     using (ConfigFile config = new ConfigFile(Application.dataPath + "/Configuration/Visuals.ini", ':', false))
     {
         config.Load();
         config.AutoSave        = false;
         FontName               = config.GetString("font");
         Font                   = AnarchyAssets.Load <Font>(FontName);
         BackgroundHex          = config.GetString("background");
         BackgroundTransparency = config.GetInt("backgroundTransparency");
         TextColors             = new string[6];
         TextColors[0]          = config.GetString("textNormal");
         TextColors[1]          = config.GetString("textHover");
         TextColors[2]          = config.GetString("textActive");
         TextColors[3]          = config.GetString("textOnNormal");
         TextColors[4]          = config.GetString("textOnHover");
         TextColors[5]          = config.GetString("textOnActive");
         TextureDeltas          = new Vector3[6];
         TextureDeltas[0]       = config.GetString("normalVector").ParseVector3();
         TextureDeltas[1]       = config.GetString("hoverVector").ParseVector3();
         TextureDeltas[2]       = config.GetString("activeVector").ParseVector3();
         TextureDeltas[3]       = config.GetString("onNormalVector").ParseVector3();
         TextureDeltas[4]       = config.GetString("onHoverVector").ParseVector3();
         TextureDeltas[5]       = config.GetString("onActiveVector").ParseVector3();
         if (!config.AllValues.ContainsKey("useVectors"))
         {
             UseVectors = false;
         }
         else
         {
             UseVectors = config.GetBool("useVectors");
         }
         TextureColors = new Color[6];
         if (!config.AllValues.ContainsKey("colorNormal") || !config.AllValues.ContainsKey("colorHover") || !config.AllValues.ContainsKey("colorActive") ||
             !config.AllValues.ContainsKey("colorOnNormal") || !config.AllValues.ContainsKey("colorOnHover") || !config.AllValues.ContainsKey("colorOnActive"))
         {
             UseVectors = true;
             Color[] colors = Helper.TextureColors(BackgroundColor, 6);
             for (int i = 0; i < 6; i++)
             {
                 TextureColors[i] = colors[i];
             }
             UseVectors = false;
         }
         else
         {
             TextureColors[0] = config.GetString("colorNormal").HexToColor();
             TextureColors[1] = config.GetString("colorHover").HexToColor();
             TextureColors[2] = config.GetString("colorActive").HexToColor();
             TextureColors[3] = config.GetString("colorOnNormal").HexToColor();
             TextureColors[4] = config.GetString("colorOnHover").HexToColor();
             TextureColors[5] = config.GetString("colorOnActive").HexToColor();
         }
         LoadPublicSettings();
     }
     wasLoaded = true;
     Initialize();
 }
예제 #3
0
 protected override void OnEnable()
 {
     profileRect             = new Rect(Style.ScreenWidth - new AutoScaleFloat(300f), 0f, new AutoScaleFloat(300f), new AutoScaleFloat(20f));
     rect                    = new SmartRect(new Rect(Style.ScreenWidth - new AutoScaleFloat(400f), Style.ScreenHeight - new AutoScaleFloat(360f), new AutoScaleFloat(396f), new AutoScaleFloat(54f)), 0f, new AutoScaleFloat(18f));
     style                   = Helper.CreateStyle(TextAnchor.MiddleRight, FontStyle.Normal, Mathf.RoundToInt(new AutoScaleFloat(35)), true, new Color[] { white, orange, yellow, white, white, white });
     style.normal.background = style.hover.background = style.active.background = EmptyTexture;
     style.font              = AnarchyAssets.Load <Font>(Style.FontName);
     allUsedPanels           = new GUIBase[] { AnarchyManager.ProfilePanel, AnarchyManager.SinglePanel, AnarchyManager.ServerList, AnarchyManager.SettingsPanel };
 }
예제 #4
0
 public static void Load()
 {
     using (ConfigFile config = new ConfigFile(Application.dataPath + "/Configuration/Visuals.ini", ':', false))
     {
         using (ConfigFile settings = new ConfigFile(Application.dataPath + "/Configuration/Settings.ini", ' ', false))
         {
             settings.Load();
             settings.AutoSave = true;
             string[] res = settings.GetString("resolution").Split('x');
             ScreenWidthDefault  = (float)System.Convert.ToInt32(res[0]);
             ScreenHeightDefault = (float)System.Convert.ToInt32(res[1]);
             if (PlayerPrefs.GetInt("AnarchyModLaunched") == 0)
             {
                 PlayerPrefs.SetInt("AnarchyModLaunched", 1);
                 float xScale     = ScreenWidthDefault / 1920f;
                 float yScale     = ScreenHeightDefault / 1080f;
                 float totalScale = (xScale + yScale) / 2f;
                 UIManager.HUDScaleGUI.Value = Mathf.Clamp(totalScale, 0.75f, 1.5f);
                 UIManager.HUDScaleGUI.Save();
             }
             ResetScreenParameters();
         }
         config.Load();
         config.AutoSave        = false;
         FontName               = config.GetString("font");
         Font                   = AnarchyAssets.Load <Font>(FontName);
         BackgroundHex          = config.GetString("background");
         BackgroundTransparency = config.GetInt("backgroundTransparency");
         TextColors             = new string[6];
         TextColors[0]          = config.GetString("textNormal");
         TextColors[1]          = config.GetString("textHover");
         TextColors[2]          = config.GetString("textActive");
         TextColors[3]          = config.GetString("textOnNormal");
         TextColors[4]          = config.GetString("textOnHover");
         TextColors[5]          = config.GetString("textOnActive");
         TextureDeltas          = new Vector3[6];
         TextureDeltas[0]       = config.GetString("normalVector").ParseVector3();
         TextureDeltas[1]       = config.GetString("hoverVector").ParseVector3();
         TextureDeltas[2]       = config.GetString("activeVector").ParseVector3();
         TextureDeltas[3]       = config.GetString("onNormalVector").ParseVector3();
         TextureDeltas[4]       = config.GetString("onHoverVector").ParseVector3();
         TextureDeltas[5]       = config.GetString("onActiveVector").ParseVector3();
         if (!config.AllValues.ContainsKey("useVectors"))
         {
             UseVectors = false;
         }
         else
         {
             UseVectors = config.GetBool("useVectors");
         }
         TextureColors = new Color[6];
         if (!config.AllValues.ContainsKey("colorNormal") || !config.AllValues.ContainsKey("colorHover") || !config.AllValues.ContainsKey("colorActive") ||
             !config.AllValues.ContainsKey("colorOnNormal") || !config.AllValues.ContainsKey("colorOnHover") || !config.AllValues.ContainsKey("colorOnActive"))
         {
             UseVectors = true;
             Color[] colors = Helper.TextureColors(BackgroundColor, 6);
             for (int i = 0; i < 6; i++)
             {
                 TextureColors[i] = colors[i];
             }
             UseVectors = false;
         }
         else
         {
             TextureColors[0] = config.GetString("colorNormal").HexToColor();
             TextureColors[1] = config.GetString("colorHover").HexToColor();
             TextureColors[2] = config.GetString("colorActive").HexToColor();
             TextureColors[3] = config.GetString("colorOnNormal").HexToColor();
             TextureColors[4] = config.GetString("colorOnHover").HexToColor();
             TextureColors[5] = config.GetString("colorOnActive").HexToColor();
         }
         LoadPublicSettings();
     }
     wasLoaded = true;
     Initialize();
 }