示例#1
0
        public void CreateMarker(ActiveMarker markerRef)
        {
            //#TODO https://www.wpf-tutorial.com/wpf-application/application-culture-uiculture/
            //keep android in mind? If we set it in common in GameState init that should be fine
            CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone();

            ci.NumberFormat.NumberDecimalSeparator = ".";
            Networking.Instance.SendMessage(
                $@"{{
                        ""cmd"": [""Marker"", ""CreateMarker""],
                        ""args"": {{
                            ""name"": {JsonConvert.ToString(markerRef.id)},
                            ""type"": {JsonConvert.ToString(markerRef.type)},
                            ""color"": {JsonConvert.ToString(markerRef.color)},
                            ""dir"": {markerRef.dir},
                            ""pos"": [{markerRef.pos[0].ToString(ci)},{markerRef.pos[1].ToString(ci)}],
                            ""text"": {JsonConvert.ToString(markerRef.text)},
                            ""shape"": {JsonConvert.ToString(markerRef.shape)},
                            ""alpha"": {markerRef.alpha},
                            ""brush"": {JsonConvert.ToString(markerRef.brush)},
                            ""size"": {JsonConvert.ToString($"[{markerRef.size}]")},
                            ""channel"": {markerRef.channel},
                            ""polyline"": [{(markerRef.polyline.Count == 0 ? "" : markerRef.polyline.Select(x => $"[{x[0].ToString(ci)},{x[1].ToString(ci)}]").Aggregate((i,j) => i+","+j))}]
                        }}
                    }}"
                );
        }
示例#2
0
 public void DeleteMarker(ActiveMarker markerRef)
 {
     Networking.Instance.SendMessage(
         $@"{{
                 ""cmd"": [""Marker"", ""DeleteMarker""],
                 ""args"": {{
                     ""mame"": ""{JsonConvert.ToString(markerRef.id)}""
                 }}
             }}"
         );
 }