Culture
How do I use Culture
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: Ref.cs
Copy
104 protected TimelineKey GetTimelineKey(XmlElement element, SpriterAnimation animation)
105 {
106 int timeline = element.GetInt("timeline", 0);
107 int key = element.GetInt("key", 0);
108
109 var timelineObj = animation.GetTimeline(timeline);
110 if (timelineObj == null)
111 {
112 Debug.LogError(String.Format(
113 System.Globalization.CultureInfo.InvariantCulture,
114 "Unable to find timeline {0} in animation {1}",
115 timeline,
116 animation.Id));
117 }
118 return timelineObj.GetKey(key);
119 }
File name: XmlUtils.cs
Copy
45 public static bool TryGetInt(this XmlNode node, string key, out int value)
46 {
47 value = default(int);
48 var attr = node.Attributes[key];
49 bool parsed = false;
50 if (attr != null)
51 {
52 parsed = int.TryParse(attr.Value, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out value);
53 }
54
55 return parsed;
56 }
File name: XmlUtils.cs
Copy
58 public static bool TryGetFloat(this XmlNode node, string key, out float value)
59 {
60 value = default(float);
61 var attr = node.Attributes[key];
62 bool parsed = false;
63 if (attr != null)
64 {
65 parsed = float.TryParse(attr.Value, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out value);
66 }
67
68 return parsed;
69 }
Culture 135 lượt xem
Gõ tìm kiếm nhanh...