Пример #1
0
    public void assembleSimForCAS(Model reflection)
    {
        AppEngine.timerBegin();
        ModelManager instance = ModelManager.getInstance();

        reflection.unload();
        this.assembleSim(0, true);
        Node node = (Node)this.m_group.getChild(0).duplicate();

        reflection.m_group.addChild(node);
        reflection.m_animPlayer3D.setNode(node);
        instance.overrideSimAppearance(node, 0, 10, 0);
        instance.overrideSimAppearance(node, 2, 12, 0);
        instance.overrideSimAppearance(node, 3, 13, 0);
        instance.overrideSimAppearance(node, 4, 14, 0);
        instance.overrideSimAppearance(node, 5, 15, 0);
        instance.overrideSimAppearance(node, 6, 16, 0);
        instance.overrideSimAppearance(node, 7, 17, 0);
        instance.overrideSimAppearance(node, 8, 18, 0);
        instance.overrideAppearance(node, 25, 26);
        ModelManager.applyCommit((Node)reflection.m_group);
        reflection.m_type = 4;
        ModelManager.applyCommit((Node)this.m_group);
        this.m_type = 3;
        AppEngine.timerEnd(nameof(assembleSimForCAS));
    }
Пример #2
0
        private static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
        {
            var exSer = AppEngine.GetRequiredService <ExceptionService>();

            exSer.Exception = e.Exception;
            e.SetObserved();
        }
Пример #3
0
        public void AddSomeServices_CallGet_MustReturnService()
        {
            AppEngine.Reset();
            AppEngine.Services.AddSingleton <A>();
            AppEngine.Services.AddScoped <B>();
            AppEngine.Services.AddTransient <C>();
            _ = AppEngine.Provider;

            Check <A>();
            Check <B>();
            Check <C>();

            void Check <T>()
            {
                var a = AppEngine.GetService(typeof(T));

                Assert.IsNotNull(a);
                Assert.IsInstanceOfType(a, typeof(T));
                a = AppEngine.GetService <T>();
                Assert.IsNotNull(a);
                a = AppEngine.GetRequiredService <T>();
                Assert.IsNotNull(a);
                a = AppEngine.GetRequiredService(typeof(T));
                Assert.IsNotNull(a);
                Assert.IsInstanceOfType(a, typeof(T));
            }
        }
Пример #4
0
        protected override WithImageStorableComicSourceInfo <TResource, TImage> CreateSourceInfo(ComicSnapshot snapshot, ComicSource source, ComicEngine engine)
        {
            var store = AppEngine.GetRequiredService <WithImageComicStoreService <TResource, TImage> >();
            var box   = store.GetStoreBox(source.TargetUrl);

            return(new WithImageStorableComicSourceInfo <TResource, TImage>(snapshot, source, engine.GetComicSourceProviderType(source.TargetUrl), box));
        }
Пример #5
0
        public static void AutoMakeUILuaScripts()
        {
            var luaPath = AppEngine.GetConfig("KSFramework.Lua", "LuaPath");

            Debug.Log("Find UI from current scenes, LuaScriptPath: " + luaPath);

            var windowAssets = GameObject.FindObjectsOfType <UIWindowAsset>();

            if (windowAssets.Length > 0)
            {
                foreach (var windowAsset in windowAssets)
                {
                    var uiName     = windowAsset.name;
                    var scriptPath = string.Format("{0}/{1}/UI/UI{2}.lua", KResourceModule.EditorProductFullPath,
                                                   luaPath, uiName);
                    if (!File.Exists(scriptPath))
                    {
                        File.WriteAllText(scriptPath, LuaUITempalteCode.Replace("$UI_NAME", "UI" + uiName));
                        Debug.LogWarning("New Lua Script: " + scriptPath);
                    }
                    else
                    {
                        Debug.Log("Exists Lua Script, ignore: " + scriptPath);
                    }
                }
            }
            else
            {
                Debug.LogError("Not found any `UIWindowAsset` Component");
            }
        }
Пример #6
0
        private static string GetFileSystemPath(string path)
        {
            var compilePath = AppEngine.GetConfig("KEngine.Setting", "SettingCompiledPath");
            var resPath     = Path.Combine(compilePath, path);

            return(resPath);
        }
Пример #7
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            appEngine = new AppEngine(loggerFactory);

            appEngine.Plugins.OrderBy(x => x.Priority).ToList().ForEach(x =>
            {
                x.Setup(Configuration);
            });

            services.AddMvc();

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "Web API", Version = "v1"
                });
                //x.IncludeXmlComments(AppContext.BaseDirectory + "YourProject.Api.xml");
                c.IgnoreObsoleteProperties();
                c.IgnoreObsoleteActions();
                c.DescribeAllEnumsAsStrings();
            });

            //Invoke appEngine

            appEngine.Plugins.OrderBy(x => x.Priority).ToList().ForEach(x =>
            {
                x.ConfigureServices(services);
            });

            appEngine.Init();
        }
Пример #8
0
        public UIModule()
        {
            var configUiBridge = AppEngine.GetConfig("KEngine.UI", "UIModuleBridge");

            if (!string.IsNullOrEmpty(configUiBridge))
            {
                var uiBridgeTypeName = string.Format("{0}", configUiBridge);
                var uiBridgeType     = KTool.FindType(uiBridgeTypeName);
                if (uiBridgeType != null)
                {
                    UiBridge = Activator.CreateInstance(uiBridgeType) as IUIBridge;
                    Log.Debug("Use UI Bridge: {0}", uiBridgeType);
                }
                else
                {
                    Log.Error("Cannot find UIBridge Type: {0}", uiBridgeTypeName);
                }
            }

            if (UiBridge == null)
            {
                UiBridge = new UGUIBridge();
            }

            UiBridge.InitBridge();
        }
Пример #9
0
    private static int getPrimitiveY(int primitiveShortIndex)
    {
        AnimationManagerData animManData = AppEngine.getCanvas().getAnimManData();

        switch (animManData.primitiveData[primitiveShortIndex])
        {
        case 0:
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
        case 6:
        case 7:
        case 9:
        case 11:
        case 12:
            return((int)animManData.primitiveData[primitiveShortIndex + 2]);

        case 8:
            int num1 = (int)animManData.primitiveData[primitiveShortIndex + 2];
            int num2 = (int)animManData.primitiveData[primitiveShortIndex + 4];
            return(num1 >= num2 ? num2 : num1);

        default:
            return(0);
        }
    }
Пример #10
0
        public static void Main(string[] args)
        {
            var builder = CreateHostBuilder(args).Build();

            AppEngine.UseProvider(builder.Services);
            builder.Run();
        }
Пример #11
0
    public static int getAnimFrameCount(int animID)
    {
        animID &= -16385;
        AnimationManagerData animManData = AppEngine.getCanvas().getAnimManData();

        return(animID < 0 || animID >= 18 ? -1 : (int)animManData.animNumFrames[animID]);
    }
Пример #12
0
    public static short getAnimFrameDuration(int animID, int frameID)
    {
        animID &= -16385;
        AnimationManagerData animManData = AppEngine.getCanvas().getAnimManData();

        return(animManData.frameDuration[(int)animManData.animFrameOffset[animID] + frameID]);
    }
Пример #13
0
    public static bool startAnim(int animID, int bitFlag)
    {
        AnimationManagerData animManData = AppEngine.getCanvas().getAnimManData();
        int index1 = -1;

        for (int index2 = 0; index2 < 48; ++index2)
        {
            if (animManData.m_animPlayerPool[index2].isAnimating())
            {
                if (animManData.m_animPlayerPool[index2].getAnimID() == animID)
                {
                    return(true);
                }
            }
            else if (index1 < 0)
            {
                index1 = index2;
            }
        }
        if (index1 < 0)
        {
            return(false);
        }
        animManData.m_animPlayerPool[index1].startAnim(animID, bitFlag);
        animManData.m_animPlayerPool[index1].setReverse(false);
        return(true);
    }
Пример #14
0
 public VisitingViewModel(Func <IServiceProvider, IComicVisiting <TImage> > visiting = null, bool ignoreVisting = false)
 {
     scope    = AppEngine.CreateScope();
     provider = scope.ServiceProvider;
     InitService(scope.ServiceProvider, visiting, ignoreVisting);
     InitVisiting();
 }
Пример #15
0
        public static AppScreenPanel CreateAppPanel(eAppPanel i_Panel, AppEngine i_AppEngine)
        {
            AppScreenPanel newPanel;

            switch (i_Panel)
            {
            case eAppPanel.HOME:
            {
                newPanel = new HomePanel(i_AppEngine);
                break;
            }

            case eAppPanel.JOB:
            {
                newPanel = new JobPanel(i_AppEngine);
                break;
            }

            case eAppPanel.MATCH:
            {
                newPanel = new MatchPanel(i_AppEngine);
                break;
            }

            default:
            {
                newPanel = null;
                break;
            }
            }

            return(newPanel);
        }
Пример #16
0
    public static CDepCollectInfo __DoBuildScriptableObject(string fullAssetPath, ScriptableObject so,
                                                            bool realBuildOrJustPath = true)
    {
        var hasBuilded = false;

        fullAssetPath = Path.ChangeExtension(fullAssetPath, AppEngine.GetConfig(KEngineDefaultConfigs.AssetBundleExt));

        if (so == null)
        {
            Log.Error("Error Null ScriptableObject: {0}", fullAssetPath);
        }
        else
        {
            //so.name = fullAssetPath;
            if (!BuildRecord.ContainsKey(fullAssetPath))
            {
                AddCache(fullAssetPath);
                if (!IsJustCollect && realBuildOrJustPath)
                {
                    BuildTools.BuildScriptableObject(so, fullAssetPath);
                    hasBuilded = true;
                }
            }
        }

        return(new CDepCollectInfo
        {
            Path = fullAssetPath,
            Asset = so,
            HasBuild = hasBuilded,
        });
    }
Пример #17
0
    private static int getPrimitiveHeight(int primitiveShortIndex)
    {
        AnimationManagerData animManData = AppEngine.getCanvas().getAnimManData();

        switch (animManData.primitiveData[primitiveShortIndex])
        {
        case 0:
        case 11:
            int index = (int)animManData.primitiveData[primitiveShortIndex + 3] & (int)ushort.MaxValue;
            return((int)animManData.m_subImages[index][4]);

        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
        case 6:
            return((int)animManData.primitiveData[primitiveShortIndex + 4]);

        case 8:
            int num = (int)animManData.primitiveData[primitiveShortIndex + 2] - (int)animManData.primitiveData[primitiveShortIndex + 4];
            return(num >= 0 ? num : -num);

        case 9:
            return(0);

        case 12:
            return((int)animManData.primitiveData[4] - (int)animManData.primitiveData[2]);

        default:
            return(0);
        }
    }
Пример #18
0
        public HomeViewModel()
        {
            ComicEngine    = AppEngine.GetRequiredService <ComicEngine>();
            SearchEngine   = AppEngine.GetRequiredService <SearchEngine>();
            ProposalEngine = AppEngine.GetRequiredService <ProposalEngine>();

            SearchCommand       = new AsyncRelayCommand(SearchAsync);
            GoSourceCommand     = new RelayCommand(GoSource);
            SetAndSearchCommand = new AsyncRelayCommand <string>(SetAndSearchAsync);
            ResetCommand        = new RelayCommand(Reset);
            SetCurrentCommand   = new RelayCommand <ComicSnapshotInfo <TSourceInfo> >(SetCurrent);
            CopyCommand         = new RelayCommand <string>(Copy);
            scope = AppEngine.CreateScope();

            observableCollectionFactory = AppEngine.GetRequiredService <IObservableCollectionFactory>();
            SearchProviders             = observableCollectionFactory.Create <ISearchProvider>();
            foreach (var item in SearchEngine)
            {
                var sp = (ISearchProvider)scope.ServiceProvider.GetRequiredService(item);
                SearchProviders.Add(sp);
            }
            CurrentSearchProvider = SearchProviders.FirstOrDefault();

            Snapshots         = observableCollectionFactory.Create <ComicSnapshotInfo <TSourceInfo> >();
            ProposalSnapshots = observableCollectionFactory.Create <ComicSnapshotInfo <TSourceInfo> >();
            EngineIcons       = observableCollectionFactory.Create <EngineInfo <TImage> >();
        }
Пример #19
0
    public static int getAnimFrameHeight(int animID, int frameID)
    {
        animID &= -16385;
        AnimationManagerData animManData = AppEngine.getCanvas().getAnimManData();
        int index1 = (int)animManData.animFrameOffset[animID] + frameID;
        int primitiveShortIndex = animManData.framePrimitiveOffset[index1];
        int frameNumPrimitive   = (int)animManData.frameNumPrimitives[index1];

        if (frameNumPrimitive == 0)
        {
            return(0);
        }
        int num1 = int.MaxValue;
        int num2 = int.MinValue;

        for (int index2 = 0; index2 != frameNumPrimitive; ++index2)
        {
            int primitiveType = (int)animManData.primitiveData[primitiveShortIndex];
            if (primitiveType != 10)
            {
                int primitiveY = AnimationManager.getPrimitiveY(primitiveShortIndex);
                int num3       = primitiveY + AnimationManager.getPrimitiveHeight(primitiveShortIndex);
                if (primitiveY < num1)
                {
                    num1 = primitiveY;
                }
                if (num3 > num2)
                {
                    num2 = num3;
                }
            }
            primitiveShortIndex += AnimationManager.getNumAttributes(primitiveType);
        }
        return(num2 - num1);
    }
Пример #20
0
 /// <summary>
 /// Unity `Awake`
 /// </summary>
 protected virtual void Awake()
 {
     GameObject.DontDestroyOnLoad(this.gameObject);
     Instance  = this;
     LuaModule = LuaModule.Instance;
     AppEngine.New(gameObject, this, CreateModules());
 }
Пример #21
0
    private TextureManager()
    {
        this.m_playerTextureFilenames = (string[][])null;
        this.m_npcTextureFilenames    = (string[][])null;
        int simCount = AppEngine.getCanvas().getSimData().getSimCount();

        this.m_playerTextureFilenames = new string[7][];
        for (int index1 = 0; index1 < 7; ++index1)
        {
            this.m_playerTextureFilenames[index1] = new string[11];
            for (int index2 = 0; index2 < 11; ++index2)
            {
                this.m_playerTextureFilenames[index1][index2] = "";
            }
        }
        this.m_npcTextureFilenames = new string[simCount][];
        for (int index1 = 0; index1 < simCount; ++index1)
        {
            this.m_npcTextureFilenames[index1] = new string[11];
            for (int index2 = 0; index2 < 11; ++index2)
            {
                this.m_npcTextureFilenames[index1][index2] = "";
            }
        }
    }
Пример #22
0
 public EntityService(CRUDService crudService, AppEngine appEngine)
 {
     this.crudService = crudService;
     this.appEngine   = appEngine;
     InitFields();
     InitSchema();
 }
Пример #23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="force">Whether or not,check diff.  false will be faster!</param>
        /// <param name="genCode">Generate static code?</param>
        public static void DoCompileSettings(bool force = true, string forceTemplate = null)
        {
            var sourcePath = SettingSourcePath;//AppEngine.GetConfig("SettingSourcePath");

            if (string.IsNullOrEmpty(sourcePath))
            {
                Log.Error("Need to KEngineConfig: SettingSourcePath");
                return;
            }
            var compilePath = AppEngine.GetConfig("KEngine.Setting", "SettingCompiledPath");

            if (string.IsNullOrEmpty(compilePath))
            {
                Log.Error("Need to KEngineConfig: SettingCompiledPath");
                return;
            }

            var bc = new BatchCompiler();

            var settingCodeIgnorePattern = AppEngine.GetConfig("KEngine.Setting", "SettingCodeIgnorePattern", false);
            var results = bc.CompileTableMLAll(sourcePath, compilePath, SettingCodePath, forceTemplate ?? DefaultTemplate.GenCodeTemplate, "AppSettings", SettingExtension, settingCodeIgnorePattern, force);

            //            CompileTabConfigs(sourcePath, compilePath, SettingCodePath, SettingExtension, force);
            var sb = new StringBuilder();

            foreach (var r in results)
            {
                sb.AppendLine(string.Format("Excel {0} -> {1}", r.ExcelFile, r.TabFileRelativePath));
            }
            Log.Info("TableML all Compile ok!\n{0}", sb.ToString());
            // make unity compile
            AssetDatabase.Refresh();
        }
Пример #24
0
    public static void renderOptionsBG(
        Graphics g,
        int x,
        int y,
        int width,
        int height,
        int buttonId)
    {
        AppEngine          canvas             = AppEngine.getCanvas();
        AnimationManager2D animationManager2D = canvas.getAnimationManager2D();

        animationManager2D.submitAnimGrid(71, 72, 73, 74, 75, 76, 77, 78, 79, (float)x, (float)y, (float)width, (float)height);
        if (buttonId != -1)
        {
            float x1 = (float)x + 23f;
            float y1 = (float)y + 33f;
            animationManager2D.submitAnim(80, x1, y1);
            float num1 = x1 - 5f;
            float num2 = y1 - 5f;
            canvas.getScene().getUIButton(buttonId).submit(ref animationManager2D, (int)num1, (int)num2);
        }
        float x2 = (float)x + 55f;
        float y2 = (float)y + 22f;
        float w  = (float)width - 90f;
        float h  = (float)height - 50f;

        animationManager2D.submitAnimGrid(102, 103, 104, 105, 106, 107, 108, 109, 110, x2, y2, w, h);
        animationManager2D.flushAnims(g);
    }
Пример #25
0
 public CRUDService(MongoService mongoService, MongoSettings settings, AppEngine lambdaManager)
 {
     _mongoService      = mongoService;
     _settings          = settings;
     this.lambdaManager = lambdaManager;
     LoadCollectionNames();
 }
Пример #26
0
        /// <summary>
        /// 惰式初始化
        /// </summary>
        public static void Init()
        {
            if (_isInited)
            {
                return;
            }

            var settingPath   = string.Format("I18N/{0}{1}", Lang, AppEngine.GetConfig(KEngineDefaultConfigs.SettingExt));
            var settingReader = SettingModule.Get(settingPath, false);

            foreach (var row in settingReader)
            {
                Strs[row["Id"]] = row["Value"];
            }

#if UNITY_EDITOR
            // 开发热重载
            if (SettingModule.IsFileSystemMode)
            {
                SettingModule.WatchSetting(settingPath, (_) =>
                {
                    _isInited = false;
                });
            }
#endif
            _isInited = true;
        }
Пример #27
0
        private async void LoadVm(string address)
        {
            vm          = new DesktopVisitingViewModel();
            DataContext = vm;
            vc          = new VisitingControlView {
                DataContext = vm
            };
            titleService = AppEngine.GetRequiredService <TitleService>();
            titleService.LeftControls.Add(vc);
            try
            {
                await vm.Visiting.LoadAsync(address);

                if (vm.HasStoreBox)
                {
                    await vm.GoChapterIndexAsync(vm.StoreBox.AttackModel.CurrentChapter);
                }
                else
                {
                    await vm.NextChapterAsync();
                }
                _ = LoadPageAsync(0);
                vm.TransverseChanged += Vm_TransverseChanged;
                rep = this.Get <ItemsRepeater>("Rep");
                car = this.Get <Carousel>("Car");
                var sv = this.Get <ScrollViewer>("RepSv");
                sv.ScrollChanged += Sv_ScrollChanged;
                this.KeyDown     += OnCarKeyDown;
                Vm_TransverseChanged(vm, vm.Transverse);
            }
            catch (Exception ex)
            {
                vm.ExceptionService.Exception = ex;
            }
        }
Пример #28
0
        public void UseProvider_ProviderMustInput()
        {
            var provider = new ServiceCollection().BuildServiceProvider();

            AppEngine.UseProvider(provider);
            Assert.AreEqual(provider, AppEngine.Provider);
        }
Пример #29
0
    //
    /// <summary>
    /// 如果非realBuild,僅返回最終路徑
    /// DoBuildAssetBundle和__DoBuildScriptableObject有两个开关,决定是否真的Build
    /// realBuildOrJustPath由外部传入,一般用于进行md5比较后,传入来的,【不收集Build缓存】 TODO:其实可以收集的。。
    /// IsJustCollect用于全局的否决真Build,【收集Build缓存】
    /// </summary>
    /// <param name="path"></param>
    /// <param name="asset"></param>
    /// <param name="realBuildOrJustPath"></param>
    /// <returns></returns>
    public static CDepCollectInfo DoBuildAssetBundle(string path, UnityEngine.Object asset,
                                                     bool realBuildOrJustPath = true)
    {
        path = Path.ChangeExtension(path, AppEngine.GetConfig(KEngineDefaultConfigs.AssetBundleExt));
        //asset.name = fullAssetPath;
        var hasBuilded = false;

        if (!BuildRecord.ContainsKey(path))
        {
            if (realBuildOrJustPath)
            {
                AddCache(path);
            }
            if (IsJustCollect)
            {
                AddCache(path);
            }
            if (!IsJustCollect && realBuildOrJustPath)
            {
                //BuildedCache[fullAssetPath] = true;
                BuildTools.BuildAssetBundle(asset, path);
                hasBuilded = true;
            }
        }

        return(new CDepCollectInfo
        {
            Path = path,
            Asset = asset,
            HasBuild = hasBuilded,
        });
    }
Пример #30
0
        /// <summary>
        /// 收集StringsTalbe.bytes的字符串
        /// </summary>
        /// <param name="refItems"></param>
        static void CollectStringsTable(ref I18NItems refItems)
        {
            var compilePath      = AppEngine.GetConfig("KEngine.Setting", "SettingCompiledPath");
            var ext              = AppEngine.GetConfig("KEngine", "AssetBundleExt");
            var stringsTablePath = string.Format("{0}/StringsTable{1}", compilePath, ext);

            if (!File.Exists(stringsTablePath))
            {
                return;
            }

            string stringsTableContent;

            using (var stream = new FileStream(stringsTablePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                using (var reader = new StreamReader(stream))
                {
                    stringsTableContent = reader.ReadToEnd();
                }
            }

            var tableFile = new TableFile(stringsTableContent);

            foreach (var row in tableFile)
            {
                var srcStr = row["Id"];
                refItems.Add(srcStr, stringsTablePath);
            }
            Debug.Log("[CollectStringsTable]Success!");
        }
        public Form1()
        {
            InitializeComponent();
            #if DEBUG
            #else
            SystemUtility.InitializeApplication();
            #endif
            engine = new AppEngine(this);
            this.AllowDrop = true;
            this.DragOver += (sn, ev) => {
                string[] files = (string[])ev.Data.GetData(DataFormats.FileDrop);
                if (files.Count() == 0) return;
                string path = files[0];
                if (!Directory.Exists(path)) { msg("The input should be a valid directory", MessageBoxIcon.Exclamation); return; }
                string name = path.Split('\\').Last();
                //if(msgask("Are you sure you want '"+path+"' as a shortcut?")==DialogResult.Yes)
                        ShortcutRepository.Add(new FolderLink() { Name = name, ExplorerLink = path });

                engine.ViewShortcuts();
            };
        }