コード例 #1
0
        public static void StartSession(string mapName, string playerMap, SimulationManager.UpdateMode mode, SimulationMetaData ngs)
        {
            try
            {
                if (Mod.IsEnabled && Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableAll) ||
                    Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableStartSession))
                {
                    if (Mod.DEBUG_LOG_ON)
                    {
                        Helper.dbgLog("Start Session telemetry disabled.");
                    }
                    return;
                }

                TelemetryKH telemetry = new TelemetryKH();
                telemetry.AddEvent("start_session", new Telemetry.Pair[]
                {
                    new Telemetry.Pair("type", playerMap),
                    new Telemetry.Pair("start_flag", mode.ToString()),
                    new Telemetry.Pair("map_name", Path.GetFileName(mapName))
                });
                if (ngs != null)
                {
                    telemetry.AddEvent("start_session", new Telemetry.Pair[]
                    {
                        new Telemetry.Pair("environment", ngs.m_environment),
                        new Telemetry.Pair("invert_traffic", ngs.m_invertTraffic),
                        new Telemetry.Pair("guid", ngs.m_gameInstanceIdentifier)
                    });
                }
                telemetry.Push();
            }
            catch (Exception ex)
            {
                CODebugBase <LogChannel> .Warn(LogChannel.HTTP, ex.GetType() + ": Telemetry event failed " + ex.Message);
            }
        }
コード例 #2
0
			private static void Deserialize(TreeManager.Data data, DataSerializer s)
			{
				short num;
				short num1;
                if (TreeUnlimiter.Mod.DEBUG_LOG_ON == true) { Debug.Log("[TreeUnlimiter::LimitTreeManager::Data:Deserialize()] calling Ensure Init"); }
                LimitTreeManager.Helper.EnsureInit(1);
				Singleton<LoadingManager>.instance.m_loadingProfilerSimulation.BeginDeserialize(s, "TreeManager");
				TreeManager treeManager = Singleton<TreeManager>.instance;
				TreeInstance[] mBuffer = treeManager.m_trees.m_buffer;
                if(TreeUnlimiter.Mod.DEBUG_LOG_ON == true) { Debug.Log("[TreeUnlimiter::LimitTreeManager::Data:Deserialize()] mbuffersize=" + mBuffer.Length.ToString()); }
                uint[] mTreeGrid = treeManager.m_treeGrid;
				int num2 = 262144;
				int length = (int)mTreeGrid.Length;
				treeManager.m_trees.ClearUnused();
				SimulationManager.UpdateMode mUpdateMode = Singleton<SimulationManager>.instance.m_metaData.m_updateMode;
                if (TreeUnlimiter.Mod.DEBUG_LOG_ON == true) { Debug.LogFormat("[TreeUnlimiter:LimitTreeManager::Data::Deserialize()] mUpdatemode" + mUpdateMode.ToString()); }
                bool flag = (mUpdateMode == SimulationManager.UpdateMode.NewAsset ? true : mUpdateMode == SimulationManager.UpdateMode.LoadAsset);

                for (int i = 0; i < length; i++)
				{
					mTreeGrid[i] = 0;
				}
				EncodedArray.UShort num3 = EncodedArray.UShort.BeginRead(s);
				for (int j = 1; j < num2; j++)
				{
					mBuffer[j].m_flags = num3.Read();
				}
				num3.EndRead();
				PrefabCollection<TreeInfo>.BeginDeserialize(s);
				for (int k = 1; k < num2; k++)
				{
					if (mBuffer[k].m_flags != 0)
					{
						mBuffer[k].m_infoIndex = (ushort)PrefabCollection<TreeInfo>.Deserialize();
					}
				}
				PrefabCollection<TreeInfo>.EndDeserialize(s);
				EncodedArray.Short num4 = EncodedArray.Short.BeginRead(s);
				for (int l = 1; l < num2; l++)
				{
					if (mBuffer[l].m_flags == 0)
					{
						num = 0;
					}
					else
					{
						num = num4.Read();
					}
					mBuffer[l].m_posX = num;
				}
				num4.EndRead();
				EncodedArray.Short num5 = EncodedArray.Short.BeginRead(s);
				for (int m = 1; m < num2; m++)
				{
					if (mBuffer[m].m_flags == 0)
					{
						num1 = 0;
					}
					else
					{
						num1 = num5.Read();
					}
					mBuffer[m].m_posZ = num1;
				}
				num5.EndRead();
				for (int n = 1; n < num2; n++)
				{
					mBuffer[n].m_nextGridTree = 0;
					mBuffer[n].m_posY = 0;
				}
				if (LimitTreeManager.Helper.UseModifiedTreeCap)
				{
                    if (TreeUnlimiter.Mod.DEBUG_LOG_ON == true) { Debug.LogFormat("[TreeUnlimiter::LimitTreeManager::Data:Deserialize()] Using ModifiedTreeCap - Calling Custom Deserializer."); }
					LimitTreeManager.CustomSerializer.Deserialize();
				}
				treeManager.m_trees.ClearUnused();
				for (int o = 0; o < LimitTreeManager.Helper.TreeLimit; o++)
				{
					if (mBuffer[o].m_flags == 0)
					{
						treeManager.m_trees.ReleaseItem((uint)o);
					}
					else
					{
						LimitTreeManager.InitializeTree(treeManager, (uint)o, ref mBuffer[o], flag);
					}
				}
				Singleton<LoadingManager>.instance.m_loadingProfilerSimulation.EndDeserialize(s, "TreeManager");
			}