public _RenderSlider( float?value = null, int?divisions = null, string label = null, SliderThemeData sliderTheme = null, MediaQueryData mediaQueryData = null, RuntimePlatform?platform = null, ValueChanged <float> onChanged = null, ValueChanged <float> onChangeStart = null, ValueChanged <float> onChangeEnd = null, _SliderState state = null, TextDirection?textDirection = null ) { D.assert(value != null && value >= 0.0 && value <= 1.0); D.assert(state != null); D.assert(textDirection != null); this.onChangeStart = onChangeStart; this.onChangeEnd = onChangeEnd; _platform = platform; _label = label; _value = value.Value; _divisions = divisions; _sliderTheme = sliderTheme; _mediaQueryData = mediaQueryData; _onChanged = onChanged; _state = state; _textDirection = textDirection.Value; _updateLabelPainter(); GestureArenaTeam team = new GestureArenaTeam(); _drag = new HorizontalDragGestureRecognizer { team = team, onStart = _handleDragStart, onUpdate = _handleDragUpdate, onEnd = _handleDragEnd, onCancel = _endInteraction }; _tap = new TapGestureRecognizer { team = team, onTapDown = _handleTapDown, onTapUp = _handleTapUp, onTapCancel = _endInteraction }; _overlayAnimation = new CurvedAnimation( parent: _state.overlayController, curve: Curves.fastOutSlowIn); _valueIndicatorAnimation = new CurvedAnimation( parent: _state.valueIndicatorController, curve: Curves.fastOutSlowIn); _enableAnimation = new CurvedAnimation( parent: _state.enableController, curve: Curves.easeInOut); }
internal GalleryOptions copyWith( ThemeMode?themeMode = null, GalleryTextScaleValue textScaleFactor = null, GalleryVisualDensityValue visualDensity = null, TextDirection?textDirection = null, float?timeDilation = null, RuntimePlatform?platform = null, bool?showPerformanceOverlay = null, bool?showRasterCacheImagesCheckerboard = null, bool?showOffscreenLayersCheckerboard = null ) { return(new GalleryOptions( themeMode: themeMode ?? this.themeMode, textScaleFactor: textScaleFactor ?? this.textScaleFactor, visualDensity: visualDensity ?? this.visualDensity, textDirection: textDirection ?? this.textDirection, timeDilation: timeDilation ?? this.timeDilation, platform: platform ?? this.platform, showPerformanceOverlay: showPerformanceOverlay ?? this.showPerformanceOverlay, showOffscreenLayersCheckerboard: showOffscreenLayersCheckerboard ?? this.showOffscreenLayersCheckerboard, showRasterCacheImagesCheckerboard: showRasterCacheImagesCheckerboard ?? this.showRasterCacheImagesCheckerboard )); }
public static string GetPlatformName(RuntimePlatform?platform = null) { switch (platform ?? Application.platform) { case RuntimePlatform.Android: return(AndroidPlatform); case RuntimePlatform.IPhonePlayer: return(iOSPlatform); case RuntimePlatform.WebGLPlayer: return(WebGLPlatform); case RuntimePlatform.WindowsPlayer: return(WindowsPlatform); case RuntimePlatform.OSXPlayer: return(MacOSPlatform); case RuntimePlatform.LinuxPlayer: return(LinuxPlatform); default: return(null); } }
/// <summary> /// 将平台转为名字 /// </summary> /// <param name="platform">平台名</param> /// <returns>转换后的名字</returns> public string PlatformToName(RuntimePlatform?platform = null) { if (platform == null) { platform = Platform; } switch (platform) { case RuntimePlatform.LinuxPlayer: return("Linux"); case RuntimePlatform.WindowsPlayer: case RuntimePlatform.WindowsEditor: return("Win"); case RuntimePlatform.Android: return("Android"); case RuntimePlatform.IPhonePlayer: return("IOS"); case RuntimePlatform.OSXEditor: case RuntimePlatform.OSXPlayer: return("OSX"); default: throw new ArgumentException("Undefined Platform"); } }
private static RuntimePlatform?getPlatform(RuntimePlatform?platform) { #if UNITY_ANDROID if (platform == null) { platform = RuntimePlatform.Android; } #endif return(platform); }
/// <summary> /// 加载文件中的皮肤 /// </summary> /// <param name="path"></param> /// <returns></returns> public async Task <CardSkinData[]> loadSkins(string path, RuntimePlatform?platform = null) { #if UNITY_ANDROID if (platform == null) { platform = RuntimePlatform.Android; } #endif var dataset = platform != RuntimePlatform.Android ? await getManager <ResourceManager>().loadExcelAsDataSet(path, platform) : await getManager <ResourceManager>().loadDataSet(path, platform); if (dataset.Tables.Count < 1) { throw new Exception("空数据集"); } var table = dataset.Tables[0]; List <CardSkinData> skins = new List <CardSkinData>(); for (int i = 1; i < table.Rows.Count; i++) { var datarow = table.Rows[i]; if (datarow.ReadCol("Ignore", false)) { continue; } var skin = new CardSkinData() { id = datarow.ReadCol <int>("ID"), name = datarow.ReadCol <string>("Name"), desc = datarow.ReadCol <string>("Desc", "") }; string imagePath = datarow.ReadCol("Image", ""); try { Texture2D texture = await getManager <ResourceManager>().loadTexture(imagePath); Sprite sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(.5f, .5f), 100); skin.image = sprite; } catch (Exception e) { skin.image = await getDefaultSprite(); Debug.LogWarning("加载贴图" + imagePath + "失败:" + e); } skins.Add(skin); } return(skins.ToArray()); }
public ImageConfiguration( AssetBundle bundle = null, double?devicePixelRatio = null, Locale locale = null, Size size = null, RuntimePlatform?platform = null ) { this.bundle = bundle; this.devicePixelRatio = devicePixelRatio; this.locale = locale; this.size = size; this.platform = platform; }
public ImageConfiguration copyWith( AssetBundle bundle = null, double?devicePixelRatio = null, Locale locale = null, Size size = null, RuntimePlatform?platform = null ) { return(new ImageConfiguration( bundle: bundle?bundle: this.bundle, devicePixelRatio: devicePixelRatio ?? this.devicePixelRatio, locale: locale ?? this.locale, size: size ?? this.size, platform: platform ?? this.platform )); }
public Task <Texture2D> loadTexture(string path, RuntimePlatform?platform = null) { if (string.IsNullOrEmpty(path)) { return(null); } platform = getPlatform(platform); switch (platform) { case RuntimePlatform.Android: return(loadTextureByWebRequestWithFallback(path)); default: return(loadTextureBySystemIOWithFallback(path)); } }
public Task <DataSet> loadDataSet(string path, RuntimePlatform?platform = null) { if (string.IsNullOrEmpty(path)) { return(null); } platform = getPlatform(platform); switch (platform) { case RuntimePlatform.Android: return(loadDataSetByWebRequest(path)); default: return(loadDataSetBySystemIO(path)); } }
/// <summary> /// 加载文件中的卡片 /// </summary> /// <param name="path"></param> /// <returns></returns> public async Task <CardDefine[]> loadCards(string path, RuntimePlatform?platform = null) { #if UNITY_ANDROID if (platform == null) { platform = RuntimePlatform.Android; } #endif var dataset = platform != RuntimePlatform.Android ? await getManager <ResourceManager>().loadExcelAsDataSet(path, platform) : await getManager <ResourceManager>().loadDataSet(path, platform); if (dataset.Tables.Count < 1) { throw new Exception("空数据集"); } var table = dataset.Tables[0]; List <CardDefine> cards = new List <CardDefine>(); for (int i = 1; i < table.Rows.Count; i++) { var datarow = table.Rows[i]; if (datarow.ReadCol("Ignore", false)) { continue; } var card = new GeneratedCardDefine(); card.id = datarow.ReadCol <int>("ID"); card.type = datarow.ReadCol <string>("Type"); card.setProp(nameof(ServantCardDefine.cost), datarow.ReadCol <int>("Cost", 0)); card.setProp(nameof(ServantCardDefine.attack), datarow.ReadCol <int>("Attack", 0)); card.setProp(nameof(ServantCardDefine.life), datarow.ReadCol <int>("Life", 0)); card.setProp(nameof(ServantCardDefine.tags), datarow.ReadCol <string>("Tags", "").Split(',')); card.setProp(nameof(ServantCardDefine.keywords), datarow.ReadCol <string>("Keywords", "").Split(',')); card.setProp(nameof(ServantCardDefine.isToken), datarow.ReadCol <bool>("IsToken", false)); cards.Add(card); } return(cards.ToArray()); }
public GalleryOptions( GalleryTheme theme = null, GalleryTextScaleValue textScaleFactor = null, float timeDilation = 1.0f, RuntimePlatform?platform = null, bool showOffscreenLayersCheckerboard = false, bool showRasterCacheImagesCheckerboard = false, bool showPerformanceOverlay = false ) { D.assert(theme != null); D.assert(textScaleFactor != null); this.theme = theme; this.textScaleFactor = textScaleFactor; this.timeDilation = timeDilation; this.platform = platform ?? Application.platform; this.showOffscreenLayersCheckerboard = showOffscreenLayersCheckerboard; this.showRasterCacheImagesCheckerboard = showRasterCacheImagesCheckerboard; this.showPerformanceOverlay = showPerformanceOverlay; }
public static void SetEmulatedRuntimePlatform(RuntimePlatform?platform = null) { WindowSystemFlow instance = Object.FindObjectOfType <WindowSystemFlow>(); if (instance == null) { Debug.LogWarning("`WindowSystemFlow` was not found on the scene."); return; } if (platform != null) { instance.currentRuntimePlatform = platform.Value; instance.emulateRuntimePlatform = true; instance.emulateRuntimePlatformEditorOnly = false; } else { instance.emulateRuntimePlatformEditorOnly = true; } }
public GalleryOptions copyWith( GalleryTheme theme = null, GalleryTextScaleValue textScaleFactor = null, float?timeDilation = null, RuntimePlatform?platform = null, bool?showPerformanceOverlay = null, bool?showRasterCacheImagesCheckerboard = null, bool?showOffscreenLayersCheckerboard = null ) { return(new GalleryOptions( theme: theme ?? this.theme, textScaleFactor: textScaleFactor ?? this.textScaleFactor, timeDilation: timeDilation ?? this.timeDilation, platform: platform ?? this.platform, showPerformanceOverlay: showPerformanceOverlay ?? this.showPerformanceOverlay, showOffscreenLayersCheckerboard: showOffscreenLayersCheckerboard ?? this.showOffscreenLayersCheckerboard, showRasterCacheImagesCheckerboard: showRasterCacheImagesCheckerboard ?? this.showRasterCacheImagesCheckerboard )); }
public GalleryOptions( ThemeMode?themeMode = null, GalleryTextScaleValue textScaleFactor = null, GalleryVisualDensityValue visualDensity = null, TextDirection?textDirection = null, float timeDilation = 1.0f, RuntimePlatform?platform = null, bool showOffscreenLayersCheckerboard = false, bool showRasterCacheImagesCheckerboard = false, bool showPerformanceOverlay = false ) { textDirection = textDirection ?? TextDirection.ltr; this.themeMode = themeMode; this.textScaleFactor = textScaleFactor; this.visualDensity = visualDensity; this.textDirection = textDirection; this.timeDilation = timeDilation; this.platform = platform; this.showOffscreenLayersCheckerboard = showOffscreenLayersCheckerboard; this.showRasterCacheImagesCheckerboard = showRasterCacheImagesCheckerboard; this.showPerformanceOverlay = showPerformanceOverlay; }
private static bool ExecuteMethods <T>(ITest tests, ITestFilter testRunnerFilter, AttributeFinderBase attributeFinder, string logString, Action <T> action, RuntimePlatform?testTargetPlatform) { var exceptionsThrown = false; if (testTargetPlatform == null) { Debug.LogError("Could not determine test target platform from build target " + EditorUserBuildSettings.activeBuildTarget); return(true); } foreach (var targetClassType in attributeFinder.Search(tests, testRunnerFilter, testTargetPlatform.Value)) { try { var targetClass = (T)Activator.CreateInstance(targetClassType); Debug.LogFormat(logString, targetClassType.FullName); action(targetClass); } catch (InvalidCastException) {} catch (Exception e) { Debug.LogException(e); exceptionsThrown = true; } } return(exceptionsThrown); }
private string _platformLabel(RuntimePlatform?platform) { return(platform.ToString()); }
public static void ExecutePostBuildCleanupMethods(ITest tests, ITestFilter testRunnerFilter, RuntimePlatform?testTargetPlatform) { var attributeFinder = new PostbuildCleanupAttributeFinder(); var logString = "Executing cleanup for: {0}"; ExecuteMethods <IPostBuildCleanup>(tests, testRunnerFilter, attributeFinder, logString, targetClass => targetClass.Cleanup(), testTargetPlatform); }
private static bool ExecuteMethods <T>(ITest tests, ITestFilter testRunnerFilter, AttributeFinderBase attributeFinder, string logString, Action <T> action, RuntimePlatform?testTargetPlatform) { var exceptionsThrown = false; if (testTargetPlatform == null) { Debug.LogError("Could not determine test target platform from build target " + EditorUserBuildSettings.activeBuildTarget); return(true); } foreach (var targetClassType in attributeFinder.Search(tests, testRunnerFilter, testTargetPlatform.Value)) { try { var targetClass = (T)Activator.CreateInstance(targetClassType); Debug.LogFormat(logString, targetClassType.FullName); using (var logScope = new LogScope()) { action(targetClass); if (logScope.AnyFailingLogs()) { var failingLog = logScope.FailingLogs.First(); throw new UnhandledLogMessageException(failingLog); } if (logScope.ExpectedLogs.Any()) { var expectedLogs = logScope.ExpectedLogs.First(); throw new UnexpectedLogMessageException(expectedLogs); } } } catch (InvalidCastException) {} catch (Exception e) { Debug.LogException(e); exceptionsThrown = true; } } return(exceptionsThrown); }