Esempio n. 1
0
        private void OnRecMsg(short typeShort, byte[] data)
        {
                        #if UNITY_EDITOR
            var typeByte = (byte)typeShort;
            if (System.Enum.IsDefined(typeof(StatType), typeByte) == false)
            {
                if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true)
                {
                    UnityEngine.Debug.LogWarning("Unknown request: " + typeShort);
                }
                return;
            }

            StatType   type = (StatType)typeByte;
            StatResTOB to   = null;

            if (StatType.OnStatResScreen == type)
            {
                to = this.DeserializeB <StatResScreen>(data);
            }
            else if (StatType.OnStatResScreenTransition == type)
            {
                to = this.DeserializeB <StatResScreenTransition>(data);
            }
            else if (StatType.OnStatResHeatmapData == type)
            {
                to = this.DeserializeB <StatResHeatmapData>(data);
            }
            else
            {
                if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true)
                {
                    UnityEngine.Debug.LogWarning("Unknown request: " + type);
                }
            }

            if (this.logTcp == true && to != null)
            {
                if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true)
                {
                    UnityEngine.Debug.Log("Stat." + to.GetTypeTO() + ":" + to.idx + " " + to.GetResult().ToString());
                }
            }

            this.OnResponse(to);
                        #else
            if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true)
            {
                UnityEngine.Debug.LogWarning("Unknown request: " + typeShort);
            }
                        #endif
        }
        private void OnResponse(StatResTOB resTO)
        {
            if (this.responseMap.ContainsKey(resTO.idx) == true)
            {
                var onResult = this.responseMap[resTO.idx];
                this.responseMap.Remove(resTO.idx);

                onResult(resTO.GetResult());
            }
            else
            {
                Debug.LogWarning("Callback " + resTO.idx + " not found");
            }
        }
Esempio n. 3
0
        private void OnResponse(StatResTOB resTO)
        {
            if (this.responseMap.ContainsKey(resTO.idx) == true)
            {
                var onResult = this.responseMap[resTO.idx];
                this.responseMap.Remove(resTO.idx);

                onResult(resTO.GetResult());
            }
            else
            {
                if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true)
                {
                    UnityEngine.Debug.LogWarning("Callback " + resTO.idx + " not found");
                }
            }
        }