Example #1
0
        /// <exception cref="VariantException"></exception>
        /// <exception cref="TjsException"></exception>
        public Tjs()
        {
            // create script cache object
            mCache    = new ScriptCache(this);
            mPPValues = new Dictionary <string, int>();
            SetPpValue("version", VERSION_HEX);
            SetPpValue("environment", ENV_JAVA_APPLICATION);
            // TODO 适切な值を入れる
            SetPpValue("compatibleSystem", 1);
            // 互换システム true
            mGlobal       = new CustomObject(GLOBAL_HASH_BITS);
            mScriptBlocks = new AList <WeakReference <ScriptBlock> >();

            LoadClass(mArrayClass);
            LoadClass(mDictionaryClass);
            NativeClass math = LoadClass(new MathClass());

            LoadClass(new RandomGeneratorClass(), math);
            LoadClass(new ExceptionClass());
            LoadClass(new RegExpClass());
            //TODO: add date back
            //LoadClass(new DateClass());

            // Extended API
            LoadClass(new DebugClass());
            LoadClass(new MathExClass());
        }
Example #2
0
 public RedisClient(RedisClientConfig config)
 {
     _config         = config;
     _connectionPool = new ConnectionPool(_config);
     if (config.UseScriptCache)
     {
         Scripts = new ScriptCache(this);
     }
 }
Example #3
0
        private object CompileGenericScript(string scriptText, Type[] genericArguments)
        {
            object cachedGenericScript;

            if (ScriptCache.TryGetCachedScript(scriptText, genericArguments, out cachedGenericScript))
            {
                return(cachedGenericScript);
            }

            Type openGenericScriptType   = GetGenericWrapperOfArity(genericArguments.Count());
            Type closedGenericScriptType = openGenericScriptType.MakeGenericType(genericArguments);

            IRawScript compiledScript = _scriptCompiler.CompileScript(scriptText, genericArguments);

            var genericScript = Activator.CreateInstance(closedGenericScriptType, compiledScript);

            ScriptCache.AddCachedScript(scriptText, genericArguments, genericScript);

            return(genericScript);
        }
Example #4
0
 public virtual void Shutdown()
 {
     //variantArrayStackCompactNow();
     if (mGlobal != null)
     {
         try
         {
             mGlobal.Invalidate(0, null, mGlobal);
         }
         catch (VariantException)
         {
         }
         catch (TjsException)
         {
         }
         mGlobal.Clear();
         mGlobal = null;
     }
     if (mCache != null)
     {
         mCache = null;
     }
 }
Example #5
0
    void Start()
    {
        GameObject sceneManagerInstance = InstantiateManager(this.sceneManagerPrefab);

        Managers.SceneManager = sceneManagerInstance.GetComponent <SceneManager>();

        GameObject screenManagerInstance = InstantiateManager(this.screenManagerPrefab);

        Managers.ScreenManager = screenManagerInstance.GetComponent <ScreenManager>();

        GameObject gameClockInstance = InstantiateManager(this.gameClockPrefab);

        Managers.GameClock = gameClockInstance.GetComponent <GameClock>();

        GameObject snakeBodyCacheInst = InstantiateManager(this.snakeBodyCachePrefab);

        Managers.SnakeBodyCache = snakeBodyCacheInst.GetComponent <ScriptCache>();

        GameObject difficultyManagerInst = InstantiateManager(this.settingsManagerPrefab);

        Managers.SettingsManager = difficultyManagerInst.GetComponent <SettingsManager>();

        Managers.GameState = new GameState();
    }
 public void SetUp()
 {
     _cache = ScriptCache.GetEmptyCache();
     _cache.RegisterAll(new ScriptFactory());
 }