using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Resources; using System.Text; using System.Text.Encodings.Web; using System.Text.Json; using System.Text.Unicode; using System.Threading.Tasks; using CDSAE3_Lian_Lian_Kan.Boards; using CDSAE3_Lian_Lian_Kan.Forms; using CDSAE3_Lian_Lian_Kan.Forms.Interface; using CDSAE3_Lian_Lian_Kan.Properties; using CDSAE3_Lian_Lian_Kan.Sound; namespace CDSAE3_Lian_Lian_Kan { public static class Etcs { public class ThemeInfos { public IList? Themes { get; set; } } public class ThemeInfo: ICloneable { public string Name { get; set; } = ""; public bool AnimationUseImage { get; set; } public bool IsOutPicture { get; set; } public string? PictureName { get; set; } public bool PlayPanelUsePicture { get; set; } public bool PlayPanelPictureIsOutPicture { get; set; } public string? PlayPanelPictureName { get; set; } public IList? ThemeColor { get; set; } public IList? PlayAreaThemeColor { get; set; } public IList? ButtonColor { get; set; } public IList? ButtonSize { get; set; } public IList? StartGamePos { get; set; } public IList? ChallengeModePos { get; set; } public IList? ScoreBoardPos { get; set; } public IList? SettingsPos { get; set; } public IList? FontBlockPos { get; set; } public IList? FontBlockSize { get; set; } public IList? FontColor { get; set; } public string? Font { get; set; } public string? FontSize { get; set; } public object Clone() { return (ThemeInfo)MemberwiseClone(); } } public class ScoreRecord { public IList? RecordInfos { get; set; } } public class RecordInfo { public string? Name { get; set; } public DateTimeOffset? Time { get; set; } public int? CostTime { get; set; } public int? Score { get; set; } public string? Difficulty { get; set; } } public static int left_time { get; set; } = 180; public static int search_left_time { get; set; } = 20; public enum Difficulty { easy = 0, normal = 1, hard = 2, custom = 3, challenge = 4 } public enum Algorithm { Array = 0, Graph = 1 } public enum Theme { fruit = 0, code = 1 } public enum Direction { none = 0, up = 1, right = 2, down = 4, left = 8, up_down = 5, left_right = 10, up_right = 3, up_left = 9, down_right = 6, down_left = 12, up_down_right = 7, up_down_left = 13, up_left_right = 11, down_left_right = 14, up_down_left_right = 15 } public enum break_music { breakA, breakB } public static Dictionary decrease_per_level = new Dictionary { {1,100.0/60 }, {2,100.0/45 }, {3,100.0/35 }, {4,100.0/30 }, {5,100.0/25 }, {6,100.0/20 }, {7,100.0/15 }, {8,100.0/10 }, {9,100.0/5 }, {10,100.0/3 }}; public static string curAlbum = "C418"; public static int cus_height = 1, cus_width = 1; public static Algorithm curAlgorithm = Algorithm.Array; public static Dictionary themes { get; set; } = JsonSerializer.Deserialize(File.ReadAllText("Resources\\sources.json"), new JsonSerializerOptions() {Encoder = JavaScriptEncoder.Create(UnicodeRanges.All) })!.Themes!.ToDictionary(x => x.Name); public static System.Timers.Timer hunderd_millsecond_timer { get; set; } = new System.Timers.Timer(100) { AutoReset = true, Enabled = true }; public static Difficulty current_difficulty { get; set; } = Difficulty.normal; public static Theme current_block_theme { get; set; } = Theme.fruit; public static ThemeInfo currentThemeInfo { get; set; } = themes["Fruit"]; public static Image trans_Image { get; set; } = Resources.trans; public static (int, int) get_length_width() => current_difficulty == Difficulty.challenge ? (18, 9) : (current_difficulty != Difficulty.custom ? (7 * (1 + (int)current_difficulty), 4 * (1 + (int)current_difficulty)) : (cus_width, cus_height)); public static ConcurrentBag fruit_Images { get; set; } = new() { Resources.Apple, Resources.Banana, Resources.Beetroot, Resources.Cherry, Resources.Corn, Resources.Eggplant, Resources.Grape, Resources.Pear, Resources.Strawberry, Resources.Watermelon }; public static ConcurrentBag disappear_fruit_Images { get; set; } = new () { Resources.Gapple, Resources.Gbanana, Resources.Gbeetroot, Resources.Gcherry, Resources.Gcorn, Resources.Geggplant, Resources.Ggrape, Resources.Gpear, Resources.Gstrawberry, Resources.Gwatermelon }; public static ConcurrentBag code_Images { get; set; } = new() { Resources.cpp, Resources.cSharp, Resources.go, Resources.java, Resources.kotlin, Resources.python, Resources.ruby, Resources.rust, Resources.vue}; public static ConcurrentBag disappear_code_Images { get; set; } = new() { Resources.Gcpp, Resources.GcSharp, Resources.Ggo, Resources.Gjava, Resources.Gkotlin, Resources.Gpython, Resources.Gruby, Resources.Grust, Resources.Gvue }; public static ConcurrentDictionary direction_Images { get; set; } = new ConcurrentDictionary(new List { Resources.trans, Resources.u, Resources.r, Resources.ur, Resources.d, Resources.ud, Resources.dr, Resources.udr, Resources.l, Resources.ul, Resources.lr, Resources.ulr, Resources.dl, Resources.udl, Resources.dlr, Resources.udlr }.Select((value, index) => new { Index = (Direction)index, Value = value }).ToDictionary(item => item.Index, item => item.Value)); public static ConcurrentDictionary direction_Images_white_version { get; set; } = new ConcurrentDictionary (new List(){ Resources.trans, Resources.w_u, Resources.w_r, Resources.w_ur, Resources.w_d, Resources.w_ud, Resources.w_dr, Resources.w_udr, Resources.w_l, Resources.w_ul, Resources.w_lr, Resources.w_ulr, Resources.w_dl, Resources.w_udl, Resources.w_dlr, Resources.w_udlr }.Select((value, index) => new { Index = (Direction)index, Value = value }).ToDictionary(item => item.Index, item => item.Value)); public static ConcurrentDictionary tip_direction_Image { get; set; } = new ConcurrentDictionary(new List{ Resources.trans, Resources.tip_u, Resources.tip_r, Resources.tip_ur, Resources.tip_d, Resources.tip_ud, Resources.tip_dr, Resources.tip_udr, Resources.tip_l, Resources.tip_ul, Resources.tip_lr, Resources.tip_ulr, Resources.tip_dl, Resources.tip_udl, Resources.tip_dlr, Resources.tip_udlr }.Select((value, index) => new { Index = (Direction)index, Value = value }).ToDictionary(item => item.Index, item => item.Value)); public static Image get_block_Image(int t) => current_block_theme == Theme.fruit ? fruit_Images.ElementAt(t) : code_Images.ElementAt(t); public static Image get_disappear_Images(int t) => current_block_theme == Theme.fruit ? disappear_fruit_Images.ElementAt(t) : disappear_code_Images.ElementAt(t); public static Image get_direction_Image(Direction direction) => current_difficulty != Difficulty.challenge ? direction_Images.GetOrAdd(direction, (dire) => null!) : direction_Images_white_version.GetOrAdd(direction,(dire)=>null!); public static int Images_size() => current_block_theme switch { Theme.fruit => fruit_Images.Count(), Theme.code => code_Images.Count(), _ => 0 }; public static Image get_tip_direction_Image(Direction direction) => tip_direction_Image.GetOrAdd(direction, (dire) => null!); public static LianLianKan? form { get; set; } public static IGameControl? gameForm { get; set; }//gameBoard public static IGameMode? gameModeForm { get; set; }//entireGame public static IMenuForm? gameMenuForm { get; set; }//MenuForm public static IBack? escapableForm { get; set; } public static Board board { get; set; } = new Board(); public static Color def_Color { get; set; } = Color.FromArgb(0, 0, 0, 0); public static Color sel_Color { get; set; } = Color.FromArgb(0, 122, 204); public static Color mouse_upper_color { get; set; } = Color.FromArgb(97, 97, 108); public static Dictionary> musics { get; set; } = new Dictionary> { { "C418", new List { "C418 - Beginning 2", "C418 - Floating Trees", "C418 - Moog City 2", "C418 - Mutation" } }, {"Sea Power",new List{ "Sea Power - Advesperascit", "Sea Power - Burn, Baby, Burn", "Sea Power - Detective Arriving on the Scene", "Sea Power - Disco Elysium, Pt 1", "Sea Power - Disco Elysium, Pt 2", "Sea Power - Ecstatic Vibrations, Totally Transcendent", "Sea Power - Hope in Work and Joy in Leisure", "Sea Power - Ignus Nilsen Waltz", "Sea Power - Instrument of Surrender", "Sea Power - Krenel, Downwell, Somatosensor", "Sea Power - La Revacholiere", "Sea Power - Live With Me", "Sea Power - Martinaise, Terminal B", "Sea Power - Miss Oranje Disco Dancer", "Sea Power - Off We Go Into the Wild Pale Yonder", "Sea Power - Ployhedrons", "Sea Power - Precinct 41 Major Crime Unit", "Sea Power - Rue de Saint-Gislaine", "Sea Power - Saint-Brune 1147", "Sea Power - The Cryptozoologists", "Sea Power - The Doomed Commercial Area", "Sea Power - The Field Autopsy", "Sea Power - The Insulindian Miracle", "Sea Power - Tiger King", "Sea Power - We Are Not Checkmated", "Sea Power - Whirling In Rags 12Pm", "Sea Power - Whirling in Rags 8am", "Sea Power - Whirling in Rags 8pm", "Sea Power - Your Body Betrays Your Degeneracy", "Sea Power - Zaum" } } , {"Tatsh",new List{ "Tatsh - Xenolith" } } }; public static Audio_res_manager audio_Res_Manager { get; set; } = new Audio_res_manager(); public static Song_Audio_processer song_Audio_Processer { get; set; } = new Song_Audio_processer(); public static Info_Audio_processer info_Audio_Processer { get; set; } = new Info_Audio_processer(); public static ResourceManager res_Manager { get; set; } = new ResourceManager("CDSAE3_Lian_Lian_Kan.Properties.Resources", typeof(Resources).Assembly); public static CultureInfo res_Culture { get; set; } = new CultureInfo("en-US"); public static Setting setting { get; set; } = new Setting(); public static Charts charts { get; set; } = new Charts(); public static int Song_Volume { get; set; } = 60; public static int Info_Volume { get; set; } = 60; public static bool loadFinished { get; set; } = true; } }