Exemple #1
0
        private void MapPayer(IPlayer player, bool newWorld = false)
        {
            if (!AllObjects.TryGetValue(player.Guid, out var item))
            {
                item = new AllObjectsDictionaryItem
                {
                    ItemFromServer = player
                };

                AllObjects.Add(player.Guid, item);

                item.Controller  = Instantiate(PlayerControllerBase, new Vector3(player.X, player.Y, 0), Quaternion.identity);
                PlayerController = item.Controller as PlayerController;
            }

            if (newWorld)
            {
                // ReSharper disable once PossibleNullReferenceException
                (item.Controller as PlayerController).UpdateFromServer(player);
            }
            else
            {
                Player.IsMoving      = player.IsMoving;
                Player.MoveToX       = player.MoveToX;
                Player.MoveToY       = player.MoveToY;
                Player.WorldGuid     = player.WorldGuid;
                Player.VisibleCities = player.VisibleCities;
            }


            item.Updated = true;
        }
        public ProgramMetadataResult GetProgramMetadata(OracleProgramIdentifier identifier, int parameterCount, bool forceBuiltInFunction, bool hasAnalyticClause, bool includePlSqlObjects)
        {
            var result = new ProgramMetadataResult();

            OracleSchemaObject schemaObject;
            IEnumerable <OracleProgramMetadata> programMetadataSource = new List <OracleProgramMetadata>();

            if (String.IsNullOrEmpty(identifier.Package) && (forceBuiltInFunction || String.IsNullOrEmpty(identifier.Owner)))
            {
                var builtInProgramPackage = OracleObjectIdentifier.IdentifierBuiltInFunctionPackage;
                var programIdentifier     = OracleProgramIdentifier.CreateFromValues(builtInProgramPackage.Owner, builtInProgramPackage.Name, identifier.Name);

                if (AllObjects.TryGetValue(builtInProgramPackage, out schemaObject))
                {
                    programMetadataSource = BuiltInPackageProgramMetadata[programIdentifier];
                }

                result.Metadata = TryFindProgramOverload(programMetadataSource, identifier.Name, parameterCount, hasAnalyticClause, !forceBuiltInFunction && includePlSqlObjects);

                if (result.Metadata == null)
                {
                    if (includePlSqlObjects && AllObjects.TryGetValue(OracleObjectIdentifier.IdentifierDbmsStandard, out schemaObject))
                    {
                        programIdentifier     = OracleProgramIdentifier.CreateFromValues(builtInProgramPackage.Owner, OracleObjectIdentifier.PackageDbmsStandard, identifier.Name);
                        programMetadataSource = BuiltInPackageProgramMetadata[programIdentifier];
                        result.Metadata       = TryFindProgramOverload(programMetadataSource, identifier.Name, parameterCount, hasAnalyticClause, true);
                    }

                    if (result.Metadata == null)
                    {
                        var nonSchemaBuiltInFunctionIdentifier = OracleProgramIdentifier.CreateBuiltIn(identifier.Name);
                        result.Metadata = TryFindProgramOverload(NonSchemaBuiltInFunctionMetadata[nonSchemaBuiltInFunctionIdentifier], identifier.Name, parameterCount, hasAnalyticClause, includePlSqlObjects);
                    }
                }

                result.SchemaObject = schemaObject;
            }

            if (result.Metadata == null)
            {
                var schemaObjectFound = (String.IsNullOrWhiteSpace(identifier.Package) && AllObjects.TryGetValue(OracleObjectIdentifier.Create(identifier.Owner, identifier.Name), out schemaObject)) ||
                                        AllObjects.TryGetValue(OracleObjectIdentifier.Create(identifier.Owner, identifier.Package), out schemaObject);
                if (!schemaObjectFound || !TryGetSchemaObjectProgramMetadata(schemaObject, out programMetadataSource))
                {
                    return(result);
                }

                result.SchemaObject = schemaObject;
                var programName = String.IsNullOrEmpty(identifier.Package) ? schemaObject.GetTargetSchemaObject().Name : identifier.Name;
                result.Metadata = TryFindProgramOverload(programMetadataSource, programName, parameterCount, hasAnalyticClause, includePlSqlObjects);
            }

            return(result);
        }
Exemple #3
0
        private void MapCity(ICity city, IPlayer player)
        {
            if (!AllObjects.TryGetValue(city.Guid, out var item))
            {
                item = new AllObjectsDictionaryItem {
                    ItemFromServer = city
                };
                AllObjects.Add(city.Guid, item);
                item.Controller = Instantiate(CityControllerBase, new Vector3(city.X, city.Y, 0), Quaternion.identity);
            }

            // ReSharper disable once PossibleNullReferenceException
            (item.Controller as CityController).UpdateFromServer(city, player);
            item.Updated = true;
        }