コード例 #1
0
ファイル: Node.cs プロジェクト: lulzzz/OpenH5
        public async Task Custom(Nuid id, int custom, NList msg)
        {
            Entity entity = EntityManager.Get(id);

            if (entity != null)
            {
                await NModule.CallbackCustom(this, id, custom, msg);

                await SyncManager.Callback(SyncType.Custom, this, id, NList.New().Add(custom).Append(msg));
            }
            else
            {
                if (id.Origin == Identity)
                {
                    return;
                }

                INode node = GrainFactory.GetGrain <INode>(id.Origin);

                if (await node.IsActive())
                {
                    await node.Custom(id, custom, msg);
                }
            }
        }
コード例 #2
0
ファイル: Node.cs プロジェクト: lulzzz/OpenH5
        private async Task CallbackField(Nuid id, string field_name, FieldEvent field_event, NList args)
        {
            string entity_type = Global.NULL_STRING;
            Entity entity      = EntityManager.Get(id);

            if (entity != null)
            {
                entity_type = entity.Type;
            }
            else
            {
                entity_type = await GetCacheType(id);
            }

            EntityPrefab entity_prefab = Prefabs.GetEntity(entity_type);

            if (entity_prefab == null)
            {
                return;
            }

            if (entity_prefab.ancestors != null && entity_prefab.ancestors.Count > 0)
            {
                for (int i = entity_prefab.ancestors.Count - 1; i >= 0; i--)
                {
                    string parent_type = entity_prefab.ancestors[i];

                    await NModule.CallbackField(this, id, parent_type, field_name, field_event, args);
                }
            }

            await NModule.CallbackField(this, id, entity_type, field_name, field_event, args);

            FieldPrefab field_prefab = entity_prefab.fields[field_name];

            if (field_prefab != null && field_prefab.sync)
            {
                NList msg = NList.New().Add(id).Add(field_name).Add((int)field_event).Append(args);
                await SyncManager.Callback(SyncType.Field, this, id, msg);
            }
        }
コード例 #3
0
ファイル: Node.cs プロジェクト: lulzzz/OpenH5
        private async Task CallbackTable(Nuid id, string table_name, TableEvent table_event, NList args)
        {
            string entity_type = Global.NULL_STRING;
            Entity entity      = EntityManager.Get(id);

            if (entity != null)
            {
                entity_type = entity.Type;
            }
            else
            {
                entity_type = await GetCacheType(id);
            }

            EntityPrefab entity_prefab = Prefabs.GetEntity(entity_type);

            if (entity_prefab == null)
            {
                return;
            }

            if (entity_prefab.ancestors != null && entity_prefab.ancestors.Count > 0)
            {
                for (int i = entity_prefab.ancestors.Count - 1; i >= 0; i--)
                {
                    string parent_type = entity_prefab.ancestors[i];

                    await NModule.CallbackTable(this, id, parent_type, table_name, table_event, args);
                }
            }

            await NModule.CallbackTable(this, id, entity_type, table_name, table_event, args);

            TablePrefab table_prefab = entity_prefab.tables[table_name];

            if (table_prefab != null && table_prefab.sync)
            {
                NList msg = NList.New().Add(id).Add(table_name).Add((int)table_event).Append(args);
                await SyncManager.Callback(SyncType.Table, this, id, msg);
            }
        }
コード例 #4
0
ファイル: Node.cs プロジェクト: lulzzz/OpenH5
        private async Task CallbackEntity(Nuid id, EntityEvent entity_event, NList args)
        {
            string entity_type = Global.NULL_STRING;
            Entity entity      = EntityManager.Get(id);

            if (entity != null)
            {
                entity_type = entity.Type;
            }
            else
            {
                entity_type = await GetCacheType(id);
            }

            EntityPrefab entity_prefab = Prefabs.GetEntity(entity_type);

            if (entity_prefab == null)
            {
                return;
            }

            if (entity_prefab.ancestors != null && entity_prefab.ancestors.Count > 0)
            {
                for (int i = entity_prefab.ancestors.Count - 1; i >= 0; i--)
                {
                    string parent_type = entity_prefab.ancestors[i];

                    await NModule.CallbackEntity(this, id, parent_type, entity_event, args);
                }
            }

            await NModule.CallbackEntity(this, id, entity_type, entity_event, args);

            NList msg = NList.New().Add(id).Add((int)entity_event).Append(args);
            await SyncManager.Callback(SyncType.Entity, this, id, msg);
        }