Beispiel #1
0
        public static CAPI.ovrKeyValuePair[] DictionaryToOVRKeyValuePairs(Dictionary <string, object> dict)
        {
            if (dict == null || dict.Count == 0)
            {
                return(null);
            }

            var nativeCustomData = new CAPI.ovrKeyValuePair[dict.Count];

            int i = 0;

            foreach (var item in dict)
            {
                if (item.Value.GetType() == typeof(int))
                {
                    nativeCustomData[i] = new CAPI.ovrKeyValuePair(item.Key, (int)item.Value);
                }
                else if (item.Value.GetType() == typeof(string))
                {
                    nativeCustomData[i] = new CAPI.ovrKeyValuePair(item.Key, (string)item.Value);
                }
                else if (item.Value.GetType() == typeof(double))
                {
                    nativeCustomData[i] = new CAPI.ovrKeyValuePair(item.Key, (double)item.Value);
                }
                else
                {
                    throw new Exception("Only int, double or string are allowed types in CustomQuery.data");
                }
                i++;
            }
            return(nativeCustomData);
        }
Beispiel #2
0
        public static Request <Models.Room> UpdateDataStore(UInt64 roomID, Dictionary <string, string> data)
        {
            if (Core.IsInitialized())
            {
                CAPI.ovrKeyValuePair[] kvps = new CAPI.ovrKeyValuePair[data.Count];
                int i = 0;
                foreach (var item in data)
                {
                    kvps[i++] = new CAPI.ovrKeyValuePair(item.Key, item.Value);
                }

                return(new Request <Models.Room>(CAPI.ovr_Room_UpdateDataStore(roomID, kvps, (uint)kvps.Length)));
            }
            return(null);
        }
Beispiel #3
0
        public static Request ReportResultsInsecure(UInt64 roomID, Dictionary <string, int> data)
        {
            if (Core.IsInitialized())
            {
                CAPI.ovrKeyValuePair[] kvps = new CAPI.ovrKeyValuePair[data.Count];
                int i = 0;
                foreach (var item in data)
                {
                    kvps[i++] = new CAPI.ovrKeyValuePair(item.Key, item.Value);
                }

                return(new Request(CAPI.ovr_Matchmaking_ReportResultInsecure(roomID, kvps, (uint)kvps.Length)));
            }

            return(null);
        }