Exemplo n.º 1
0
        private void OnCmdAssignSite(RouterMessage msg)
        {
            //Decode arguments and create logger
            ManagerAssignSite   args   = msg.DeserializeAs <ManagerAssignSite>();
            MasterCommandLogger logger = new MasterCommandLogger(msg);

            //Update if it was supposed to be null
            if (args.site_id == "")
            {
                args.site_id = null;
            }

            //Find instance
            ManagerInstance instance = session.GetInstanceById(long.Parse(args.instance_id));

            if (instance == null)
            {
                logger.FinishFail("Could not find that instance on the server.");
                return;
            }

            //Run
            try
            {
                //Update
                instance.site_id = args.site_id;
                session.Save();
                session.RefreshSites();
            }
            catch (Exception ex)
            {
                logger.FinishFail($"Unexpected error: {ex.Message}{ex.StackTrace}");
            }
        }
Exemplo n.º 2
0
        private void OnCmdRemoveInstance(RouterMessage msg)
        {
            //Decode arguments and create logger
            ManagerUpdateInstance args   = msg.DeserializeAs <ManagerUpdateInstance>();
            MasterCommandLogger   logger = new MasterCommandLogger(msg);

            //Find instance
            ManagerInstance instance = session.GetInstanceById(long.Parse(args.instance_id));

            if (instance == null)
            {
                logger.FinishFail("Could not find that instance on the server.");
                return;
            }

            //Run
            try
            {
                instance.DestoryInstance(session, logger);
            }
            catch (Exception ex)
            {
                logger.FinishFail($"Unexpected error: {ex.Message}{ex.StackTrace}");
            }
        }
Exemplo n.º 3
0
        private void OnCmdRebootInstance(RouterMessage msg)
        {
            //Decode arguments and create logger
            ManagerRebootInstance args   = msg.DeserializeAs <ManagerRebootInstance>();
            MasterCommandLogger   logger = new MasterCommandLogger(msg);

            //Find instance
            ManagerInstance instance = session.GetInstanceById(long.Parse(args.instance_id));

            if (instance == null)
            {
                logger.FinishFail("Could not find that instance on the server.");
                return;
            }

            //Run
            try
            {
                //Shut down instance
                logger.Log("REBOOT", "Shutting down instance...");
                bool graceful = instance.StopInstance();
                if (!graceful)
                {
                    logger.Log("REBOOT", "Instance was shut down forcefully!");
                }

                //Start
                instance.StartInstance(session);
            }
            catch (Exception ex)
            {
                logger.FinishFail($"Unexpected error: {ex.Message}{ex.StackTrace}");
            }
        }
Exemplo n.º 4
0
    public void SpawnEntityFromSave(IEntity entity)
    {
        if (m_activeEntities == null)
        {
            Init();
        }

        Vector3    position   = WorldManager.GamePosAtTile(ManagerInstance.Get <WorldManager>().completeMap[entity.GetProperty <int>("x"), entity.GetProperty <int>("y")]);
        GameObject gameObject = GameObject.Instantiate(Resources.Load("Entities/" + entity.type), position, Quaternion.identity) as GameObject;

        switch (entity.type)
        {
        case EntityType.Actor:
            gameObject.GetComponent <EntityComponent>().SetData(entity, m_actors.GetGraphicsFor(entity.identity) as EntityGraphics);
            break;

        case EntityType.Static:
            gameObject.GetComponent <EntityComponent>().SetData(entity, m_staticEntities.GetGraphicsFor(entity.identity) as EntityGraphics);
            break;

        case EntityType.Dynamic:
            gameObject.GetComponent <EntityComponent>().SetData(entity, m_dynamicEntities.GetGraphicsFor(entity.identity) as EntityGraphics);
            break;
        }

        m_activeEntities.Add(entity);
    }
Exemplo n.º 5
0
 /// <summary>
 /// The event fired when the entity is spawned into the game world
 /// </summary>
 public void OnSpawn()
 {
     ManagerInstance.Get <FogOfWarManager>().RegisterVision(this, 10);
     m_renderer = m_gameObject.GetComponent <SpriteRenderer>();
     m_line     = m_gameObject.GetComponent <LineRenderer>();
     m_jobQueue = new List <ActorJob>();
 }
Exemplo n.º 6
0
 protected void SetInputDevice(int index)
 {
     if (!ManagerInstance)
     {
         return;
     }
     ManagerInstance.SetAudioDevice(index);
 }
 private async Task <IEnumerable <object> > GetDataAsync()
 {
     return(await Task.Factory.StartNew(() =>
     {
         //using (var mgr = LookupHelper.GetItemSourceManager(LookUp))
         return ManagerInstance.GetFiltered(_filter0, GetModeEnum.Partial);
     }));
 }
Exemplo n.º 8
0
 protected void ResetSpectrumData()
 {
     if (!ManagerInstance)
     {
         return;
     }
     ManagerInstance.ResetSpectrum();
 }
Exemplo n.º 9
0
    public void SetGraphics(TextureMode mode)
    {
        GetComponent <Renderer>().sharedMaterial = new Material(Resources.Load("Materials/chunk") as Material);
        Texture2D oldTex = GetComponent <Renderer>().sharedMaterial.mainTexture as Texture2D;

        GetComponent <Renderer>().sharedMaterial.mainTexture = oldTex;
        GetComponent <Renderer>().sharedMaterial.mainTexture = ManagerInstance.Get <WorldGraphicsManager>().GetTextureForChunk(m_chunk.x, m_chunk.y, mode);
        m_chunk.AddChunkToDrawQueue();
    }
Exemplo n.º 10
0
    public Texture2D GetTextureForChunk(int chunkX, int chunkY, TextureMode mode)
    {
        switch (mode)
        {
        case TextureMode.None:
            break;

        case TextureMode.Default:
            Texture2D tex = new Texture2D(Chunk.WIDTH * TILE_RESOLUTION, Chunk.HEIGHT * TILE_RESOLUTION);
            tex.filterMode = FilterMode.Point;

            for (int x = 0; x < tex.width; x++)
            {
                for (int y = 0; y < tex.height; y++)
                {
                    tex.SetPixel(x, y, Color.green);
                }
            }

            tex.Apply();
            return(tex);

        case TextureMode.Active:
            List <ChunkTile> drawQueue = ManagerInstance.Get <WorldManager>().GetChunkAt(chunkX, chunkY).tileDrawQueue;
            Texture2D        activeTex = ManagerInstance.Get <WorldManager>().GetChunkObjectAt(chunkX, chunkY).texture;

            if (activeTex == null)
            {
                activeTex = new Texture2D(Chunk.WIDTH * TILE_RESOLUTION, Chunk.HEIGHT * TILE_RESOLUTION);
            }
            activeTex.filterMode = FilterMode.Point;

            for (int i = 0; i < drawQueue.Count; i++)
            {
                activeTex.SetPixels(drawQueue[i].x * TILE_RESOLUTION, drawQueue[i].y * TILE_RESOLUTION, TILE_RESOLUTION, TILE_RESOLUTION, TileTexture(drawQueue[i].worldX, drawQueue[i].worldY));
                if (drawQueue[i].identity != "default")
                {
                    if (playMode)
                    {
                        ManagerInstance.Get <WorldManager>().GetChunkObjectAt(chunkX, chunkY).EmiteParticles(drawQueue[i].x, drawQueue[i].y, TileSelectionPanel.i.selectedTile.graphics.particleColor);
                    }
                }
            }

            drawQueue.Clear();
            activeTex.Apply();
            return(activeTex);

        case TextureMode.Serialized:
            break;

        default:
            break;
        }

        return(null);
    }
Exemplo n.º 11
0
    public void SpawnEntity(string identity, EntityType type, int x, int y)
    {
        Vector3    position   = WorldManager.GamePosAtTile(ManagerInstance.Get <WorldManager>().completeMap[x, y]);
        GameObject gameObject = GameObject.Instantiate(Resources.Load("Entities/" + type), position, Quaternion.identity) as GameObject;

        bool foundData = false;

        switch (type)
        {
        case EntityType.None:
            break;

        case EntityType.Actor:
            for (int i = 0; i < m_actors.loadedData.Count; i++)
            {
                if (m_actors.loadedData[i].identity == identity)
                {
                    gameObject.GetComponent <EntityComponent>().SetData(m_actors.loadedData[i].Clone(), m_actors.loadedGraphics[i]);
                    foundData = true;
                }
            }
            break;

        case EntityType.Static:
            for (int i = 0; i < m_staticEntities.loadedData.Count; i++)
            {
                if (m_staticEntities.loadedData[i].identity == identity)
                {
                    gameObject.GetComponent <EntityComponent>().SetData(m_staticEntities.loadedData[i].Clone(), m_staticEntities.loadedGraphics[i]);
                    foundData = true;
                }
            }
            break;

        case EntityType.Dynamic:
            for (int i = 0; i < m_dynamicEntities.loadedData.Count; i++)
            {
                if (m_dynamicEntities.loadedData[i].identity == identity)
                {
                    gameObject.GetComponent <EntityComponent>().SetData(m_dynamicEntities.loadedData[i].Clone(), m_dynamicEntities.loadedGraphics[i]);
                    foundData = true;
                }
            }
            break;

        default:
            break;
        }

        m_activeEntities.Add(gameObject.GetComponent <EntityComponent>().entity);
        if (!foundData)
        {
            Destroy(gameObject);
            CommandInput.DebugLog(new string[] { "Entity Not Found" });
        }
    }
Exemplo n.º 12
0
 private void bEdit_Click(object sender, EventArgs e)
 {
     if (this.lbKeys.SelectedIndex >= 0)
     {
         MetaValue       value        = this.dictionaryKeys[this.lbKeys.SelectedIndex];
         ManagerInstance formInstance = new ManagerInstance(this.repository, value.Type, value);
         formInstance.Text = value.Type.GetNameWithModule();
         formInstance.ShowDialog();
         this.dictionaryKeys[this.lbKeys.SelectedIndex] = formInstance.Value;
         this.RefreshData();
     }
 }
Exemplo n.º 13
0
    //Logic loop
    //Plan:
    //job state(Idle, moving, doing)

    //Job Queue
    //Job: position, type(kill, build, collect), job target, importance

    //if idle
    //look for job
    //if no job wait (jobSeekingCooldown)

    //if moving
    //go to job position
    //if postition reached
    //state = doing

    //if doing
    //tell target job progress
    //if progress = complete

    //goto next job item


    public void OnUpdate(float deltaTime)
    {
        if (m_jobQueue.Count > 0)
        {
            switch (currentJob.state)
            {
            case ActorJobState.Moving:
                FollowPath();
                break;

            case ActorJobState.Doing:
                currentJob.OnAction();
                break;

            case ActorJobState.Done:
                m_jobQueue.Remove(currentJob);
                break;
            }
        }
        else
        {
            //seek new job
            //if found new job
            // ActorJob job = new ActorJob(this, ActorJobType.Kill, ManagerInstance.Get<WorldManager>().completeMap[25, 25], this);
            // m_jobQueue.Add(job);

            //currentPath.AddRange(ManagerInstance.Get<PathingManager>().GetPath(currentTile, job.targetTile));
            //else waitfor(jobSeekingCooldown)
        }

        //old
        if (m_selected)
        {
            if (Input.GetMouseButton(1))
            {
                if (MouseInput.hoveredTile.tranversable)
                {
                    m_displayPath = new List <Node>();
                    m_displayPath.AddRange(ManagerInstance.Get <PathingManager>().GetPath(currentTile, MouseInput.hoveredTile));
                    m_line.enabled = true;
                    UpdatePathLine();
                }
            }
            if (Input.GetMouseButtonUp(1))
            {
                m_currentPath = new List <Node>();
                m_currentPath.AddRange(ManagerInstance.Get <PathingManager>().GetPath(currentTile, MouseInput.hoveredTile));
                ActorJob moveJob = new ActorJob(this, ActorJobType.Move, MouseInput.hoveredTile, null);
                m_jobQueue.Add(moveJob);
            }
        }
    }
Exemplo n.º 14
0
        private async Task <IEnumerable <object> > GetDataAsync()
        {
            if (LookUpInfo == null)
            {
                return(null);
            }

            return(await Task.Factory.StartNew(() =>
            {
                var attrEntity = LookupHelper.GetAttrEntity(LookUpInfo);
                return ManagerInstance.GetFiltered(_filter0, attrEntity);
            }));
        }
Exemplo n.º 15
0
 private void AddDependencySatisfaction(ManagerInstance instance)
 {
     foreach (Type supplied in instance.SuppliedManagers)
     {
         if (_dependencySatisfaction.ContainsKey(supplied))
         {
             // When we already have a manager supplying this component we have to unregister it.
             _dependencySatisfaction[supplied] = null;
         }
         else
         {
             _dependencySatisfaction.Add(supplied, instance);
         }
     }
 }
Exemplo n.º 16
0
    private void Init()
    {
        grid             = new Node[WorldManager.worldWidth * Chunk.WIDTH, WorldManager.worldHeight *Chunk.HEIGHT];
        ChunkTile[,] map = ManagerInstance.Get <WorldManager>().completeMap;

        for (int x = 0; x < WorldManager.worldWidth * Chunk.WIDTH; x++)
        {
            for (int y = 0; y < WorldManager.worldHeight * Chunk.HEIGHT; y++)
            {
                ChunkTile tile = map[x, y];
                grid[x, y] = new Node(tile.tranversable, tile.worldX, tile.worldY);
            }
        }

        m_path  = new List <Node>();
        m_paths = new List <Path>();
    }
Exemplo n.º 17
0
 /// <summary>
 /// Освобождение ресурсов.
 /// </summary>
 /// <param name="disposing">False - если требуется освободить только UnManaged ресурсы, True - если еще и Managed</param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         EditValueChanged   -= OnEditValueChanged;
         DataContextChanged -= OnDataContextChanged;
         UnSubscribeDataContext(DataContext);
         if (ManagerInstance != null)
         {
             ManagerInstance.Changed -= ManagerInstanceOnChanged;
             ManagerInstance.Dispose();
             ManagerInstance = null;
         }
         ItemsSource = null;
     }
     // unmanaged objects and resources
 }
Exemplo n.º 18
0
    public Chunk(int chunkX, int chunkY)
    {
        m_tileDrawQueue = new List <ChunkTile>();

        m_x     = chunkX;
        m_y     = chunkY;
        m_tiles = new ChunkTile[WIDTH, HEIGHT];

        for (int x = 0; x < WIDTH; x++)
        {
            for (int y = 0; y < HEIGHT; y++)
            {
                m_tiles[x, y] = new ChunkTile(x, y, "grass", true, this);
                m_tiles[x, y].ChangeTo(ManagerInstance.Get <DatabaseManager>().dataBase.GetDataFor(m_tiles[x, y].identity));
            }
        }
    }
Exemplo n.º 19
0
    public static void Spawn(string[] param)
    {
        string     identity = param[1];
        EntityType type;

        if (param[0] == "Actor" || param[0] == "Static" || param[0] == "Dynamic")
        {
            type = (EntityType)Enum.Parse(typeof(EntityType), param[0], true);
        }
        else
        {
            DebugLog(new string[] { "Entity Type Not found" });
            return;
        }

        int x = Int32.Parse(param[2]);
        int y = Int32.Parse(param[3]);

        ManagerInstance.Get <EntityManager>().SpawnEntity(identity, type, x, y);
    }
Exemplo n.º 20
0
    private void RefreshUI()
    {
        if (ManagerInstance.Get <DatabaseManager>().dataBase != null)
        {
            for (int i = 0; i < ManagerInstance.Get <DatabaseManager>().dataBase.loadedData.Count; i++)
            {
                ChunkTileSerialized tile = ManagerInstance.Get <DatabaseManager>().dataBase.loadedData[i];
                GameObject          ui   = GameObject.Instantiate(Resources.Load("UI/Tile Button") as GameObject);
                ui.transform.parent = transform;
                ui.name             = "Tile: " + tile.identity;

                ui.GetComponent <RectTransform>().anchoredPosition = new Vector2(10 + i * 85, 0);
                ui.GetComponent <RectTransform>().localScale       = new Vector2(1, 1);
                ui.GetComponent <Image>().sprite = Sprite.Create(ManagerInstance.Get <DatabaseManager>().dataBase.loadedGraphics[i].ToTexture(ManagerInstance.Get <DatabaseManager>().dataBase.loadedGraphics[i].texture), new Rect(0, 0, WorldGraphicsManager.TILE_RESOLUTION, WorldGraphicsManager.TILE_RESOLUTION), new Vector2(0, 0));
                ui.GetComponent <TileSelectionButton>().tileIndex = i;

                m_tileButtons.Add(ui);
            }
        }
    }
        private void InitManager()
        {
            // reset current
            managerInstance = null;

            var newInstance = new ManagerInstance();

            var bindingManager = BindingManager.Instance;
            var managerType    = typeof(BindingManager);

            // get private field
            var field = managerType.GetField("sourceDictionary", BindingFlags.NonPublic | BindingFlags.Instance);

            newInstance.sourceDictionary = (Dictionary <string, object>)field.GetValue(bindingManager);

            field = managerType.GetField("dataContextDictionary", BindingFlags.NonPublic | BindingFlags.Instance);
            newInstance.dataContextDictionary = (Dictionary <string, List <IDataContext> >)field.GetValue(bindingManager);

            managerInstance = newInstance;
        }
Exemplo n.º 22
0
    public List <ChunkTile> GetAllNeighbors()
    {
        List <ChunkTile> neighbors = new List <ChunkTile>();

        ChunkTile[,] fullMap = ManagerInstance.Get <WorldManager>().completeMap;

        if (worldX > 0)
        {
            neighbors.Add(fullMap[worldX - 1, worldY]);
            if (worldY < WorldManager.worldHeight * Chunk.HEIGHT - 1)
            {
                neighbors.Add(fullMap[worldX - 1, worldY + 1]);
            }
            if (worldY > 0)
            {
                neighbors.Add(fullMap[worldX - 1, worldY - 1]);
            }
        }
        if (worldY > 0)
        {
            neighbors.Add(fullMap[worldX, worldY - 1]);
            if (worldX < WorldManager.worldWidth * Chunk.WIDTH - 1)
            {
                neighbors.Add(fullMap[worldX + 1, worldY - 1]);
            }
        }
        if (worldY < WorldManager.worldHeight * Chunk.HEIGHT - 1)
        {
            neighbors.Add(fullMap[worldX, worldY + 1]);
            if (worldX < WorldManager.worldWidth * Chunk.WIDTH - 1)
            {
                neighbors.Add(fullMap[worldX + 1, worldY + 1]);
            }
        }
        if (worldX < WorldManager.worldWidth * Chunk.WIDTH - 1)
        {
            neighbors.Add(fullMap[worldX + 1, worldY]);
        }

        return(neighbors);
    }
Exemplo n.º 23
0
        private async Task OnCmdGetInstanceStatus(RouterMessage msg)
        {
            //Create buffer for output. It consists of this format, each a byte unless otherwise stated: [status, reserved, appVersionMajor, appVersionMinor, libVersionMajor, libVersionMinor, (ushort)time]
            byte[] buffer = new byte[8];
            buffer[0] = (byte)InstanceStatusResult.NOT_CONNECTED;

            //Find instance
            ManagerInstance instance = session.GetInstanceById(BitConverter.ToInt64(msg.payload, 0));

            if (instance != null && instance.linkedSession != null)
            {
                try
                {
                    //Send ping
                    DateTime start      = DateTime.UtcNow;
                    var      pingResult = await instance.linkedSession.SendPing(4000);

                    if (pingResult != null)
                    {
                        //Success
                        buffer[0] = (byte)InstanceStatusResult.ONLINE;
                        buffer[2] = pingResult.Value.lib_version_major;
                        buffer[3] = pingResult.Value.lib_version_minor;
                        buffer[4] = pingResult.Value.app_version_major;
                        buffer[5] = pingResult.Value.app_version_minor;
                        BitConverter.GetBytes((ushort)Math.Min(ushort.MaxValue, (DateTime.UtcNow - start).TotalMilliseconds)).CopyTo(buffer, 6);
                    }
                    else
                    {
                        //Timed out
                        buffer[0] = (byte)InstanceStatusResult.PING_TIMED_OUT;
                    }
                } catch
                {
                    buffer[0] = (byte)InstanceStatusResult.PING_FAILED;
                }
            }

            //Send
            msg.Respond(buffer, true);
        }
Exemplo n.º 24
0
    /*
     *
     * private string[,] m_tiles;
     * private float[,] m_FOW;
     * private List<IEntity> m_entities;
     *
     * private List<IEntity> m_entityDependencies;
     * private List<ChunkTileSerialized> m_tileDependencies;
     * */

    public void LoadSaveIntoGame()
    {
        ChunkTile[,] map = ManagerInstance.Get <WorldManager>().completeMap;
        for (int x = 0; x < WorldManager.worldWidth * Chunk.WIDTH; x++)
        {
            for (int y = 0; y < WorldManager.worldHeight * Chunk.HEIGHT; y++)
            {
                map[x, y].ChangeTo(ManagerInstance.Get <DatabaseManager>().dataBase.GetDataFor(m_tiles[x, y]));
            }
        }

        if (ManagerInstance.Get <FogOfWarManager>() != null)
        {
            ManagerInstance.Get <FogOfWarManager>().SetMap(m_FOW);
        }

        for (int i = 0; i < m_entities.Count; i++)
        {
            ManagerInstance.Get <EntityManager>().SpawnEntityFromSave(m_entities[i]);
        }
    }
Exemplo n.º 25
0
        private void HandleLoginCommand(RouterSession session, RouterMessage msg)
        {
            //Get details
            DeltaCoreNetServerType type = (DeltaCoreNetServerType)BitConverter.ToInt32(msg.payload, 0);
            long loginKey = BitConverter.ToInt64(msg.payload, 4);

            //Find the linked instance
            ManagerInstance instance = null;

            lock (this.session.instances)
            {
                foreach (var s in this.session.instances)
                {
                    if (loginKey == s.id)
                    {
                        instance = s;
                    }
                }
            }

            //If this failed, abort
            if (instance == null)
            {
                logger.Log("HandleLoginCommand", $"Logging in client {session.GetDebugName()} with key {loginKey} FAILED. Dropping client...", DeltaLogLevel.Medium);
                io.DropClient(session);
                return;
            }

            //Set properties on session
            session.authenticatedType = type;
            instance.linkedSession    = session;
            session.linkedInstance    = instance;
            session.authenticated     = true;

            //Log
            logger.Log("HandleLoginCommand", $"Logged in client {session.GetDebugName()} as {type.ToString().ToUpper()} as {instance.id} (v {instance.version_id}).", DeltaLogLevel.Low);
        }
Exemplo n.º 26
0
        /// <inheritdoc/>
        public bool AddManager(IManager manager)
        {
            if (_initialized)
            {
                throw new InvalidOperationException("Can't add new managers to an initialized dependency manager");
            }
            // Protect against adding a manager derived from an existing manager
            if (_registeredManagers.Any(x => x.Instance.GetType().IsInstanceOfType(manager)))
            {
                return(false);
            }
            // Protect against adding a manager when an existing manager derives from it.
            // ReSharper disable once ConvertIfStatementToReturnStatement
            if (_registeredManagers.Any(x => manager.GetType().IsInstanceOfType(x.Instance)))
            {
                return(false);
            }

            ManagerInstance instance = new ManagerInstance(manager);

            _registeredManagers.Add(instance);
            AddDependencySatisfaction(instance);
            return(true);
        }
Exemplo n.º 27
0
 public async Task OnUnloadAsync()
 {
     ManagerInstance.Stop();
 }
Exemplo n.º 28
0
 private void bEdit_Click(object sender, EventArgs e)
 {
     if (this.lbKeys.SelectedIndex >= 0)
     {
         MetaValue value = this.dictionaryKeys[this.lbKeys.SelectedIndex];
         ManagerInstance formInstance = new ManagerInstance(this.repository, value.Type, value);
         formInstance.Text = value.Type.GetNameWithModule();
         formInstance.ShowDialog();
         this.dictionaryKeys[this.lbKeys.SelectedIndex] = formInstance.Value;
         this.RefreshData();
     }
 }
Exemplo n.º 29
0
 //undos the OnTileBuild Effect
 public void OnTileDestroy(int x, int y)
 {
     ManagerInstance.Get <FogOfWarManager>().DrawCircle(x, y, 2, 0.95f);
 }
Exemplo n.º 30
0
 //removes all fog of war around the newly created tile
 public void OnTileBuild(int x, int y)
 {
     ManagerInstance.Get <FogOfWarManager>().DrawCircle(x, y, 2, 0.55f);
 }
Exemplo n.º 31
0
 private void vlButtonManage_Click(object sender, EventArgs e)
 {
     Button button = (Button)sender;
     ManagerInstance formInstance;
     ManagerList formList;
     ManagerDictionary formDictionary;
     MetaInstanceVariable metaInstanceVariable;
     switch (this.value.Type.CategoryType)
     {
         case ECategoryType.Integral:
             // can't happen
             break;
         case ECategoryType.Enum:
             // can't happen (for now)
             break;
         case ECategoryType.Class:
             for (int i = 0; i < this.value.Instance.InstanceVariables.Count; i++)
             {
                 metaInstanceVariable = this.value.Instance.InstanceVariables[i];
                 if (button.Name == metaInstanceVariable.ToString())
                 {
                     MetaValue value = metaInstanceVariable.Value;
                     switch (value.Type.CategoryType)
                     {
                         case ECategoryType.Integral:
                             // can't happen
                             break;
                         case ECategoryType.Class:
                             formInstance = new ManagerInstance(this.repository, value.Type, value, metaInstanceVariable.Variable.Nullable);
                             formInstance.Text = metaInstanceVariable.ToString();
                             formInstance.ShowDialog();
                             metaInstanceVariable.Value = formInstance.Value;
                             break;
                         case ECategoryType.List:
                             formList = new ManagerList(this.repository, value.Type.SubType1, value.List);
                             formList.Text = metaInstanceVariable.ToString();
                             formList.ShowDialog();
                             value.List = formList.ListValues;
                             break;
                         case ECategoryType.Dictionary:
                             formDictionary = new ManagerDictionary(this.repository, value.Type.SubType1, value.Type.SubType2, value.Dictionary);
                             formDictionary.Text = metaInstanceVariable.ToString();
                             formDictionary.ShowDialog();
                             value.Dictionary = formDictionary.DictionaryValues;
                             break;
                     }
                     this.RefreshData();
                     break;
                 }
             }
             break;
         case ECategoryType.List:
             formList = new ManagerList(this.repository, this.value.Type.SubType1, this.value.List);
             formList.Text = this.value.Type.GetNameWithModule();
             formList.ShowDialog();
             this.value.List = formList.ListValues;
             break;
         case ECategoryType.Dictionary:
             formList = new ManagerList(this.repository, this.value.Type.SubType1, this.value.List);
             formList.Text = this.value.Type.GetNameWithModule();
             formList.ShowDialog();
             this.value.List = formList.ListValues;
             break;
     }
 }
 void OnDisable()
 {
     managerInstance = null;
 }