2024-03-22 17:03:01 +08:00
using System ;
2024-04-19 10:00:37 +08:00
using System.Collections.Concurrent ;
2024-03-22 17:03:01 +08:00
using System.Collections.Generic ;
2024-03-29 14:18:38 +08:00
using System.Globalization ;
2024-03-22 17:03:01 +08:00
using System.Linq ;
2024-03-29 14:18:38 +08:00
using System.Resources ;
2024-03-22 17:03:01 +08:00
using System.Text ;
2024-04-18 08:38:59 +08:00
using System.Text.Encodings.Web ;
using System.Text.Json ;
using System.Text.Unicode ;
2024-03-22 17:03:01 +08:00
using System.Threading.Tasks ;
2024-04-02 23:14:34 +08:00
using CDSAE3_Lian_Lian_Kan.Boards ;
2024-03-22 17:03:01 +08:00
using CDSAE3_Lian_Lian_Kan.Forms ;
2024-04-18 08:38:59 +08:00
using CDSAE3_Lian_Lian_Kan.Forms.Interface ;
2024-03-22 17:03:01 +08:00
using CDSAE3_Lian_Lian_Kan.Properties ;
2024-03-29 14:18:38 +08:00
using CDSAE3_Lian_Lian_Kan.Sound ;
2024-03-22 17:03:01 +08:00
namespace CDSAE3_Lian_Lian_Kan
{
2024-04-02 21:57:04 +08:00
public static class Etcs
2024-03-22 17:03:01 +08:00
{
2024-04-18 08:38:59 +08:00
public class ThemeInfos
{
public IList < ThemeInfo > ? Themes { get ; set ; }
}
2024-04-22 13:48:40 +08:00
public class ThemeInfo : ICloneable
2024-04-18 08:38:59 +08:00
{
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 < int > ? ThemeColor { get ; set ; }
public IList < int > ? PlayAreaThemeColor { get ; set ; }
public IList < int > ? ButtonColor { get ; set ; }
public IList < int > ? ButtonSize { get ; set ; }
public IList < int > ? StartGamePos { get ; set ; }
public IList < int > ? ChallengeModePos { get ; set ; }
public IList < int > ? ScoreBoardPos { get ; set ; }
public IList < int > ? SettingsPos { get ; set ; }
public IList < int > ? FontBlockPos { get ; set ; }
public IList < int > ? FontBlockSize { get ; set ; }
public IList < int > ? FontColor { get ; set ; }
public string? Font { get ; set ; }
public string? FontSize { get ; set ; }
2024-04-22 13:48:40 +08:00
public object Clone ( )
{
return ( ThemeInfo ) MemberwiseClone ( ) ;
}
2024-04-18 08:38:59 +08:00
}
public class ScoreRecord
{
public IList < RecordInfo > ? 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 ; }
}
2024-03-22 17:03:01 +08:00
public static int left_time { get ; set ; } = 180 ;
2024-03-29 14:18:38 +08:00
public static int search_left_time { get ; set ; } = 20 ;
2024-03-22 17:03:01 +08:00
public enum Difficulty
2024-04-18 08:38:59 +08:00
{
2024-03-22 17:03:01 +08:00
easy = 0 ,
normal = 1 ,
hard = 2 ,
2024-04-19 10:00:37 +08:00
custom = 3 ,
challenge = 4
}
public enum Algorithm
{
Array = 0 ,
Graph = 1
2024-03-22 17:03:01 +08:00
}
2024-04-18 08:38:59 +08:00
public enum Theme
2024-03-22 17:03:01 +08:00
{
2024-04-19 10:00:37 +08:00
fruit = 0 ,
code = 1
2024-03-22 17:03:01 +08:00
}
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 ,
2024-03-29 14:18:38 +08:00
down_left = 12 ,
up_down_right = 7 ,
up_down_left = 13 ,
up_left_right = 11 ,
down_left_right = 14 ,
up_down_left_right = 15
2024-03-22 17:03:01 +08:00
}
2024-04-02 21:57:04 +08:00
public enum break_music
{
breakA ,
breakB
}
2024-03-22 17:03:01 +08:00
public static Dictionary < int , double > decrease_per_level = new Dictionary < int , double > {
{ 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 } } ;
2024-04-19 10:00:37 +08:00
public static string curAlbum = "C418" ;
2024-04-18 08:38:59 +08:00
public static int cus_height = 1 , cus_width = 1 ;
2024-04-19 10:00:37 +08:00
public static Algorithm curAlgorithm = Algorithm . Array ;
2024-04-18 08:38:59 +08:00
public static Dictionary < string , ThemeInfo > themes { get ; set ; } = JsonSerializer . Deserialize < ThemeInfos > ( File . ReadAllText ( "Resources\\sources.json" ) , new JsonSerializerOptions ( )
{ Encoder = JavaScriptEncoder . Create ( UnicodeRanges . All )
} ) ! . Themes ! . ToDictionary ( x = > x . Name ) ;
2024-04-08 21:04:47 +08:00
public static System . Timers . Timer hunderd_millsecond_timer { get ; set ; } = new System . Timers . Timer ( 100 ) { AutoReset = true , Enabled = true } ;
2024-03-29 14:18:38 +08:00
public static Difficulty current_difficulty { get ; set ; } = Difficulty . normal ;
2024-04-19 10:00:37 +08:00
public static Theme current_block_theme { get ; set ; } = Theme . fruit ;
2024-04-18 08:38:59 +08:00
public static ThemeInfo currentThemeInfo { get ; set ; } = themes [ "Fruit" ] ;
2024-03-22 17:03:01 +08:00
public static Image trans_Image { get ; set ; } = Resources . trans ;
2024-04-19 10:00:37 +08:00
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 < Image > 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 < Image > 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 < Image > 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 < Image > 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 , Image > direction_Images { get ; set ; } = new ConcurrentDictionary < Direction , Image > ( new List < Image > { 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 , Image > direction_Images_white_version { get ; set ; } = new ConcurrentDictionary < Direction , Image > ( new List < Image > ( ) { 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 < Direction , Image > tip_direction_Image { get ; set ; } = new ConcurrentDictionary < Direction , Image > ( new List < Image > { 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 ! ) ;
2024-03-22 17:03:01 +08:00
public static LianLianKan ? form { get ; set ; }
2024-04-18 08:38:59 +08:00
public static IGameControl ? gameForm { get ; set ; } //gameBoard
public static IGameMode ? gameModeForm { get ; set ; } //entireGame
public static IMenuForm ? gameMenuForm { get ; set ; } //MenuForm
2024-04-22 13:48:40 +08:00
public static IBack ? escapableForm { get ; set ; }
2024-03-22 17:03:01 +08:00
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 ) ;
2024-04-02 21:57:04 +08:00
public static Color mouse_upper_color { get ; set ; } = Color . FromArgb ( 97 , 97 , 108 ) ;
2024-04-18 08:38:59 +08:00
public static Dictionary < string , List < string > > musics { get ; set ; } = new Dictionary < string , List < string > > { { "C418" , new List < string > { "C418 - Beginning 2" , "C418 - Floating Trees" , "C418 - Moog City 2" , "C418 - Mutation" } } ,
2024-04-19 10:00:37 +08:00
{ "Sea Power" , new List < string > { "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 < string > { "Tatsh - Xenolith" } } } ;
2024-04-08 21:04:47 +08:00
public static Audio_res_manager audio_Res_Manager { get ; set ; } = new Audio_res_manager ( ) ;
2024-04-02 21:57:04 +08:00
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 ( ) ;
2024-03-29 14:18:38 +08:00
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" ) ;
2024-04-18 08:38:59 +08:00
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 ;
2024-04-02 21:57:04 +08:00
2024-03-22 17:03:01 +08:00
}
}