Exemplo n.º 1
0
        /// <summary>
        /// 开启游戏世界
        /// </summary>
        public void StartWorld()
        {
            if (m_isStartWorld)
            {
                return;
            }
            m_isStartWorld = true;

            StaticConfigFileManager.LoadData();

            InitLogicModule();

            StartServerSocket();

            TimerThread.MainTask = mainTask;
            TimerThread.StartTimerThread();

            mainTask.StartThread();

            if (UseManyTaskThread)
            {
                lowTask.StartThread();
                assistTask.StartThread();
            }
        }
Exemplo n.º 2
0
        public void TestArrayClassProperty()
        {
            StaticConfigFileManager.LoadData();

            Assert.IsNotNull(ClassArrayProperty.Pt);

            var len = ClassArrayProperty.Pt.Length;

            Assert.AreEqual(2, len);

            var pro = ClassArrayProperty.Pt[0];

            Assert.AreEqual("abc123中国", pro.StrData);
            Assert.AreEqual(123, pro.IntData);
            Assert.AreEqual(123.123, pro.DoubleData);
            Assert.AreEqual(220000000000, pro.LongData);
            Assert.AreEqual(true, pro.BoolData);

            pro = ClassArrayProperty.Pt[1];

            Assert.AreEqual("123中国", pro.StrData);
            Assert.AreEqual(321, pro.IntData);
            Assert.AreEqual(321.321, pro.DoubleData);
            Assert.AreEqual(110000000000, pro.LongData);
            Assert.AreEqual(false, pro.BoolData);
        }
Exemplo n.º 3
0
        public void OtherNameNode()
        {
            StaticConfigFileManager.LoadData();

            Assert.AreEqual("abc中国", OtherName.StrData);
            Assert.AreEqual(220000000000, OtherName.LongData);
            Assert.AreEqual(false, OtherName.BoolData);
        }
Exemplo n.º 4
0
        public void DefaultValueTest()
        {
            StaticConfigFileManager.LoadData();

            Assert.AreEqual("abc", TestConfigClassByDefaultValue.StrData);
            Assert.AreEqual(10, TestConfigClassByDefaultValue.IntData);
            Assert.AreEqual(321.321, TestConfigClassByDefaultValue.DoubleData);
            Assert.AreEqual(220000000000, TestConfigClassByDefaultValue.LongData);
            Assert.AreEqual(true, TestConfigClassByDefaultValue.BoolData);
        }
Exemplo n.º 5
0
        public void BaseLoadTest()
        {
            StaticConfigFileManager.LoadData();

            Assert.AreEqual("abc123中国", TestConfigClass1.StrData);
            Assert.AreEqual(123, TestConfigClass1.IntData);
            Assert.AreEqual(123.123, TestConfigClass1.DoubleData);
            Assert.AreEqual(220000000000, TestConfigClass1.LongData);
            Assert.AreEqual(true, TestConfigClass1.BoolData);
        }
Exemplo n.º 6
0
        public void TestClassProperty()
        {
            StaticConfigFileManager.LoadData();

            Assert.IsNotNull(ClassProperty.Pt);

            Assert.AreEqual("abc123中国", ClassProperty.Pt.StrData);
            Assert.AreEqual(123, ClassProperty.Pt.IntData);
            Assert.AreEqual(123.123, ClassProperty.Pt.DoubleData);
            Assert.AreEqual(220000000000, ClassProperty.Pt.LongData);
            Assert.AreEqual(true, ClassProperty.Pt.BoolData);
        }
Exemplo n.º 7
0
        /// <summary>
        ///     开启游戏
        /// </summary>
        /// <remarks>
        ///     游戏启动执行顺序
        ///     1.FirstInit
        ///     2.InitTemplate
        ///     3.LoadDefaultGameData
        ///     4.BeforeModuleInit
        ///     5.world.Start()
        ///     6.AfterModuleInit
        /// </remarks>
        /// <param name="world"></param>
        public static void StartGame(WorldBase world)
        {
            if (world == null)
            {
                throw new NullReferenceException("world");
            }

            s_world = world;

            RunType = ServerStateType.Starting;

            //  先加载最基础的配置文件
            StaticConfigFileManager.LoadData();

            if (FirstInit != null)
            {
                IsErrorToExitProgram(FirstInit());
            }

            if (InitTemplate != null)
            {
                IsErrorToExitProgram(InitTemplate());
            }

            if (LoadDefaultGameData != null)
            {
                IsErrorToExitProgram(LoadDefaultGameData());
            }

            if (BeforeModuleInit != null)
            {
                IsErrorToExitProgram(BeforeModuleInit());
            }

            world.StartWorld();

            if (AfterModuleInit != null)
            {
                IsErrorToExitProgram(AfterModuleInit());
            }

            RunType = ServerStateType.Runing;

            if (IsConsoleRun)
            {
                StartCommandlinesDisposal();
            }
        }
Exemplo n.º 8
0
        public void BaseLoadArrayTest()
        {
            StaticConfigFileManager.LoadData();

            Assert.AreEqual(2, BaseArray.StrData.Length);
            Assert.AreEqual("abc123中国", BaseArray.StrData[0]);
            Assert.AreEqual("abc123中国2", BaseArray.StrData[1]);

            Assert.AreEqual(3, BaseArray.IntData.Length);
            Assert.AreEqual(1, BaseArray.IntData[0]);
            Assert.AreEqual(2, BaseArray.IntData[1]);
            Assert.AreEqual(3, BaseArray.IntData[2]);

            Assert.AreEqual(0, BaseArray.DoubleData.Length);

            Assert.AreEqual(1, BaseArray.LongData.Length);
            Assert.AreEqual(220000000000, BaseArray.LongData[0]);

            Assert.AreEqual(2, BaseArray.BoolData.Length);
            Assert.AreEqual(true, BaseArray.BoolData[0]);
            Assert.AreEqual(false, BaseArray.BoolData[1]);
        }