Example #1
0
        static void Main(string[] args)
        {
            var resourcesSystem = new ResourcesSystem();
            var renderingSystem = new RenderingSystem();
            var inputSystem     = new InputSystem();
            var timeSystem      = new TimeSystem();

            resourcesSystem.Setup();
            timeSystem.Setup();
            inputSystem.Setup();
            renderingSystem.Setup(inputSystem, resourcesSystem);
            while (true)
            {
                timeSystem.Update();
                renderingSystem.Update();
                inputSystem.Update();
            }
        }
Example #2
0
 public MaterialStrategy(ResourcesSystem resourcesSystem)
 {
     this.resourcesSystem = resourcesSystem;
 }
 void Awake()
 {
     instance = this;
 }
Example #4
0
 public SkyboxStrategy(ResourcesSystem resourcesSystem)
 {
     this.resourcesSystem = resourcesSystem;
 }
Example #5
0
        void DoPublish()
        {
            if (string.IsNullOrEmpty(mLastPatchPath) || !Directory.Exists(mLastPatchPath) ||
                string.IsNullOrEmpty(mCurrPatchPath) || !Directory.Exists(mCurrPatchPath))
            {
                ShowNotification(new GUIContent("错误:路径为空或不存在此路径"));
                return;
            }

            string tmpRuntimeResFullPath = Path.GetFullPath(PathHelper.RUN_TIME_RES_PATH).Replace("\\", "/");
            string tmpBundlePath         = $"{tmpRuntimeResFullPath}/{string.Format(PathHelper.BUNDLE_FOLDER, mPlatform)}/";    //源资源bundle路径
            string tmpTblFolder          = PathHelper.GetBytesFileFoldNameByType(PathHelper.EBytesFileType.Table);              //源资源tbl文件夹
            string tmpSkillActionFolder  = PathHelper.GetBytesFileFoldNameByType(PathHelper.EBytesFileType.Action);             //源资源SkillAction文件夹

            string tmpPatchPath = mCurrPatchPath + mPlatform + "/Patch_" + System.DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"); //当前补丁存放路径

            if (!Directory.Exists(tmpPatchPath))
            {
                Directory.CreateDirectory(tmpPatchPath);
            }

            //把bundle文件对应平台文件copy一份到StreamingAssets
            List <ResouceElement> tmpStreamingAssetsList = PublishUtility.GetResouceElements(tmpBundlePath, ResouceElement.EResType.AssetBundle, string.Empty);

            //处理tbl
            List <ResouceElement> tmpTblList = PublishUtility.GetResouceElements($"{tmpRuntimeResFullPath}/{tmpTblFolder}", ResouceElement.EResType.Bytes, tmpTblFolder);

            //游戏动作
            List <ResouceElement> tmpActionList = PublishUtility.GetResouceElements($"{tmpRuntimeResFullPath}/{tmpSkillActionFolder}", ResouceElement.EResType.Bytes, tmpSkillActionFolder);

            List <ResouceElement> tmpAllResList = new List <ResouceElement>();

            tmpAllResList.AddRange(tmpStreamingAssetsList);
            tmpAllResList.AddRange(tmpTblList);
            tmpAllResList.AddRange(tmpActionList);

            uint tmpVersionFileCrc = FileHelper.ResVersionFileCRC;
            uint tmpResDescFileCrc = 0;

            PublishUtility.GenResDescAndVersionFile(tmpPatchPath, tmpAllResList, FileHelper.RES_DESC_FILE, out tmpResDescFileCrc,
                                                    tmpVersionFileCrc, mMajor, mMinor, mSvn);

            //差异比较
            string tmpPath = $"{mLastPatchPath}/{FileHelper.ResVersionFileCRC}";

            if (!File.Exists(tmpPath))
            {
                ShowNotification(new GUIContent($"错误:找不到最后一次补丁的版本描述文件 {FileHelper.ResVersionFileCRC}"));
                return;
            }

            byte[]      tmpData            = FileHelper.ReadFile(tmpPath);
            VersionData tmpLastVersionData = VersionData.LoadVersionData(tmpData);

            tmpPath = $"{mLastPatchPath}/{tmpLastVersionData.ResDescCrc}";
            if (!File.Exists(tmpPath))
            {
                ShowNotification(new GUIContent($"错误:找不到最后一次补丁的资源描述文件 {tmpLastVersionData.ResDescCrc}"));
                return;
            }

            tmpData = FileHelper.ReadFile(tmpPath);
            Dictionary <uint, long> tmpLastResDescInfo = ResourcesSystem.LoadResDescInfo(tmpData);
            List <ResouceElement>   tmpDiffList        = new List <ResouceElement>();

            for (int i = 0, max = tmpAllResList.Count; i < max; ++i)
            {
                ResouceElement tmpResElem = tmpAllResList[i];
                long           tmpResFlag = 0;

                if (tmpLastResDescInfo.TryGetValue(tmpResElem.keyHash, out tmpResFlag))
                {
                    var tmpResInfo = ResourcesSystem.ResFlag2Info(tmpResFlag);

                    if (tmpResElem.fileHash == tmpResInfo.FileHash)
                    {
                        continue;
                    }
                }

                tmpDiffList.Add(tmpResElem);
            }

            PublishUtility.GenAssistDescFile(tmpDiffList, tmpPatchPath, $"{mMajor}.{mMinor}.{mSvn}", tmpVersionFileCrc.ToString(), tmpResDescFileCrc.ToString());
            PublishUtility.CopyRes2Path(tmpDiffList, tmpPatchPath, string.Empty);

            ShowNotification(new GUIContent($"打包补丁成功 差异化文件 {tmpDiffList.Count} 个"));
        }
Example #6
0
        public void Setup(InputSystem inputSystem, ResourcesSystem resourcesSystem)
        {
            this.inputSystem = inputSystem;
            Handle           = CreateFile("CONOUT$", 0x40000000, 2, IntPtr.Zero, FileMode.Open, 0, IntPtr.Zero);
            Map  = string.Empty;
            Map += "MMMMMMMMMMMMMMMM";
            Map += "M..............M";
            Map += "M..............M";
            Map += "MFFFF..........M";
            Map += "M..............M";
            Map += "M..............M";
            Map += "M..........OOOOM";
            Map += "M..............M";
            Map += "M..............M";
            Map += "M..............M";
            Map += "MMMMMMMMMMMMMMMM";

            DisplayMap  = string.Empty;
            DisplayMap += "###~LEVEL-1~####";
            DisplayMap += "#              #";
            DisplayMap += "#              #";
            DisplayMap += "#              #";
            DisplayMap += "#          #####";
            DisplayMap += "#              #";
            DisplayMap += "#              #";
            DisplayMap += "#####          #";
            DisplayMap += "#              #";
            DisplayMap += "#              #";
            DisplayMap += "################";
            ScreenSize  = new Vector2Int(Console.WindowWidth, Console.WindowHeight);

            Cameras = new List <ICameraComponent>();
            var camera = CreateCamera();

            camera.ViewPort = new Rect(0f, 0f, 1f, 1f);
            camera.Entity.GetComponent <ITransformComponent>().Position = new Vector2(8f, 5f);
            Cameras.Add(camera);

            //var camera2 = CreateCamera();
            //camera2.ViewPort = new Rect(0.5f, 0.5f, 0.5f, 0.5f);
            //camera2.Entity.GetComponent<ITransformComponent>().Position = new Vector2(8f, 5f);
            //Cameras.Add(camera2);

            wallMaterial = resourcesSystem.Load <ConsoleMaterial>("Materials/BrickMaterial");
            floorSprite  = resourcesSystem.Load <ConsoleSprite>("Textures/brick_wall");

            Renderers = new List <IRendererComponent>();
            var cat = CreateCat();

            cat.Entity.GetComponent <ITransformComponent>().Position = new Vector2(8.5f, 8.5f);
            cat.Entity.GetComponent <IRendererComponent>().Material  = resourcesSystem.Load <ConsoleMaterial>("Materials/CatMaterial");
            Renderers.Add(cat);

            cat = CreateCat();
            cat.Entity.GetComponent <ITransformComponent>().Position = new Vector2(9.5f, 9.5f);
            cat.Entity.GetComponent <IRendererComponent>().Material  = resourcesSystem.Load <ConsoleMaterial>("Materials/CatMaterial");
            Renderers.Add(cat);

            UpdateCharBuffer();

            skybox = resourcesSystem.Load <SkyboxMaterial>("Materials/Skybox");
        }