Beispiel #1
0
        // Methods
        public static OmniJournal CreateOutOfWorld(OmniJournalData data, SimDescription Actor)
        {
            OmniJournal journal = ObjectCreation.CreateObject(0x6694B72C99D44369, ProductVersion.BaseGame, null) as OmniJournal;

            if (journal == null)
            {
                return(null);
            }

            journal.Data            = data.Clone();
            journal.mJournalEdition = data.CurrentEdition + SimClock.ElapsedCalendarDays();
            journal.Data.ID         = data.ID + journal.mJournalEdition;

            Career career = Actor.Occupation as Career;

            if (career != null)
            {
                journal.mBookCareer = career.SharedData.Name;
            }

            journal.mBookLevelId  = Actor.Occupation.CareerLevel;
            journal.mBookId       = journal.Data.ID;
            journal.mOwner        = Actor;
            journal.mUpdatedToday = true;
            journal.SetGeometryState(journal.Data.GeometryState);
            journal.SetMaterial(journal.Data.MaterialState);
            return(journal);
        }
Beispiel #2
0
 void ResetObjectSpawner(ObjectCreation TEMP)
 {
     TEMP.gameObject.transform.position   = new Vector3(0, 0, 0);
     TEMP.gameObject.transform.localScale = new Vector3(1, 1, 1);
     TEMP.gameObject.transform.rotation   = Quaternion.identity;
     TEMP.ResetObjectSpawner();
 }
Beispiel #3
0
        public override void VisitObjectCreation(ObjectCreation node)
        {
            Append("new ");
            Append(node.Type);
            Append("(");

            node.Arguments?.Accept(this);

            Append(")");
        }
        public static void AddImageProvider <T>(string basePath) where T : ImageProviderBase
        {
            if (string.IsNullOrEmpty(basePath))
            {
                throw new ArgumentException("Base path may not be null or empty. Use SetDefaultImageProvider<T> instead.");
            }
            if (ImageProviders.ContainsKey(basePath))
            {
                throw new ArgumentException("Base path already exists in collection.");
            }

            var objectCreator = ObjectCreation.GetCreator <T, ImageProviderBase>();

            ImageProviders.Add(basePath, objectCreator);
        }
Beispiel #5
0
        internal static IExpression Create(TokenType tokenType, SourcePosition pos, object value)
        {
            var exprType = Instance[tokenType];

            if (typeCache.ContainsKey(exprType))
            {
                return((IExpression)typeCache[exprType](pos, value));
            }
            else
            {
                var creator = ObjectCreation.GetCreator(exprType, new Type[] { typeof(SourcePosition), value.GetType() });
                typeCache.Add(exprType, creator);
                return((IExpression)creator(pos, value));
            }

            //return (IExpression)Activator.CreateInstance(Instance[tokenType], pos, value);
        }
Beispiel #6
0
    private float TimeToSpawnObjects = 0;               // Calculated time to spawn a set of objects

    void Start()
    {
        EventManager.resetObjects += Reset;

        if (!objectToSpawn.GetComponent <SpriteRenderer> ())
        {
            objectToSpawn.AddComponent <SpriteRenderer> ();
        }

        objectSpawner = gameObject.AddComponent <ObjectCreation> ();

//		objectSpawner.EnablePooling = EnablePooling;
        objectSpawner.SetProjectile(0, objectToSpawn);
        objectSpawner.SetKinematic(0, Kinematic);
        if (RandomColor)
        {
            objectSpawner.SetColor_Random(0);
        }

        TimeToSpawnObjects = NumberOfObjects * (AppearDelay + 0.01f);

        ObjectSpawnerType = new ObjectSpawnerDelegate[]
        {
            Shoot_AtTarget,
            Shoot_InDirection,
            Shoot_FollowTarget,
            Shoot_RandomSprayOutwards,
            Shoot_CircularSpray,
            Shoot_WaveSpray,
            Shoot_FromScreenEdge,
            Shoot_CircleBurst,
        };

        if (!TargetPlayer && TargetObject == null)
        {
            TargetObject = gameObject;
        }

        if (IsEnabled)
        {
            StartCoroutine("C_StartSpawner");
        }
    }
        public override void VisitObjectCreation(ObjectCreation node)
        {
            var typeName = node.Type;

            Append("(New-Object -TypeName ");
            Append(typeName);

            if (!node.Arguments.Arguments.Any())
            {
                Append(")");
                return;
            }
            ;

            Append(" -ArgumentList ");

            VisitArgumentList(node.Arguments);

            Append(")");
        }
Beispiel #8
0
        public override Node VisitStartProcessIntent(StartProcessIntent intent)
        {
            var processCreation = new ObjectCreation("Process", null);
            var processVariable = new VariableDeclaration("Process", new VariableDeclarator("process", processCreation));

            var processInfoCreation = new ObjectCreation("ProcessStartInfo", null);
            var processInfoVariable = new VariableDeclaration("ProcessStartInfo", new VariableDeclarator("startInfo", processInfoCreation));

            var setFileName        = new MemberAccess(new IdentifierName("startInfo"), "FileName");
            var filePathAssignment = new Assignment(setFileName, intent.FilePath);

            var setArguments        = new MemberAccess(new IdentifierName("startInfo"), "Arguments");
            var argumentsAssignment = new Assignment(setArguments, intent.Arguments);

            var setStartInfo        = new MemberAccess(new IdentifierName("process"), "StartInfo");
            var startInfoAssignment = new Assignment(setStartInfo, new IdentifierName("startInfo"));

            var start = new Invocation(new MemberAccess(new IdentifierName("process"), "Start"), new ArgumentList());

            return(new Block(processVariable, processInfoVariable, filePathAssignment, argumentsAssignment, startInfoAssignment, start));
        }
Beispiel #9
0
 void IEventsVisitor.Visit(ObjectCreation objectCreation)
 {
     message = "created";
 }
Beispiel #10
0
            protected override void OnPerform()
            {
                int roomId = 0;
                Lot lot    = null;

                if (mTarget.CreatedSim != null)
                {
                    Vector3 location = mTarget.CreatedSim.PositionOnFloor;

                    lot    = mTarget.CreatedSim.LotCurrent;
                    roomId = mTarget.CreatedSim.RoomId;

                    List <GnomeData> gnomes = new List <GnomeData>();

                    if (mTarget.TraitManager.HasElement(TraitNames.CultureChina))
                    {
                        gnomes.Add(new GnomeData(0x000000000098977D, ProductVersion.EP1));
                    }
                    else if ((mTarget.TraitManager.HasElement(TraitNames.CultureEgypt)) || (mTarget.IsMummy))
                    {
                        gnomes.Add(new GnomeData(0x000000000098977C, ProductVersion.EP1));
                    }
                    else if (mTarget.TraitManager.HasElement(TraitNames.CultureFrance))
                    {
                        gnomes.Add(new GnomeData(0x000000000098977E, ProductVersion.EP1));
                    }
                    else if (mTarget.IsVampire)
                    {
                        gnomes.Add(new GnomeData(0x000000000098A1C2, ProductVersion.EP3));
                    }
                    else if (mTarget.IsFrankenstein)
                    {
                        gnomes.Add(new GnomeData(0x0000000000989CD9, ProductVersion.EP2));
                    }
                    else if ((mTarget.IsCelebrity) || (mTarget.AssignedRole is RolePaparazzi))
                    {
                        gnomes.Add(new GnomeData(0x000000000098A1C4, ProductVersion.EP3));
                    }
                    else if (mTarget.Occupation is MagicianCareer)
                    {
                        gnomes.Add(new GnomeData(0x000000000098D215, ProductVersion.EP6)); // Magician
                    }
                    else if (mTarget.Occupation is SingerCareer)
                    {
                        gnomes.Add(new GnomeData(0x000000000098D214, ProductVersion.EP6)); // Singer
                    }
                    else if (mTarget.IsCat)
                    {
                        gnomes.Add(new GnomeData(0x000000000098AAD6, ProductVersion.EP5)); // Pet Cat
                    }
                    else if (mTarget.IsADogSpecies)
                    {
                        gnomes.Add(new GnomeData(0x000000000098AAD5, ProductVersion.EP5)); // Pet Dog
                    }
                    else if (mTarget.IsHorse)
                    {
                        gnomes.Add(new GnomeData(0x000000000098AAD4, ProductVersion.EP5)); // Pet Horse
                    }
                    else
                    {
                        gnomes.Add(new GnomeData(0x000000000000058B, ProductVersion.BaseGame)); // Normal

                        if (GameUtils.IsInstalled(ProductVersion.EP1))
                        {
                            gnomes.Add(new GnomeData(0x000000000098977D, ProductVersion.EP1)); // China
                            gnomes.Add(new GnomeData(0x000000000098977C, ProductVersion.EP1)); // Egypt
                            gnomes.Add(new GnomeData(0x000000000098977E, ProductVersion.EP1)); // France
                        }

                        if (GameUtils.IsInstalled(ProductVersion.EP2))
                        {
                            gnomes.Add(new GnomeData(0x0000000000989EEC, ProductVersion.EP2)); // Caveman
                            gnomes.Add(new GnomeData(0x0000000000989CD9, ProductVersion.EP2)); // Inventor
                            gnomes.Add(new GnomeData(0x0000000000989EDF, ProductVersion.EP2)); // Laundry
                            gnomes.Add(new GnomeData(0x0000000000989CF2, ProductVersion.EP2)); // Sculptor
                        }

                        if (GameUtils.IsInstalled(ProductVersion.EP3))
                        {
                            gnomes.Add(new GnomeData(0x000000000098A1C4, ProductVersion.EP3)); // Celebrity
                            gnomes.Add(new GnomeData(0x000000000098A1C2, ProductVersion.EP3)); // Vampire
                        }

                        if (GameUtils.IsInstalled(ProductVersion.EP5))
                        {
                            gnomes.Add(new GnomeData(0x000000000098AEB1, ProductVersion.EP5)); // Freezer Bunny
                            gnomes.Add(new GnomeData(0x000000000098AAD6, ProductVersion.EP5)); // Pet Cat
                            gnomes.Add(new GnomeData(0x000000000098AAD5, ProductVersion.EP5)); // Pet Dog
                            gnomes.Add(new GnomeData(0x000000000098AAD4, ProductVersion.EP5)); // Pet Horse
                        }

                        if (GameUtils.IsInstalled(ProductVersion.EP6))
                        {
                            gnomes.Add(new GnomeData(0x000000000098D215, ProductVersion.EP6)); // Magician
                            gnomes.Add(new GnomeData(0x000000000098D214, ProductVersion.EP6)); // Singer
                        }
                    }

                    if (gnomes.Count > 0)
                    {
                        GnomeData preferred = RandomUtil.GetRandomObjectFromList(gnomes);

                        MagicGnomeBase gnome = ObjectCreation.CreateObject(preferred.mInstance, preferred.mVersion, null) as MagicGnomeBase;
                        if (gnome != null)
                        {
                            NameComponent name = gnome.GetComponent <NameComponent>();
                            if (name != null)
                            {
                                name.mName = mTarget.FullName;
                            }

                            gnome.SetPosition(location);
                            gnome.AddToWorld();
                        }
                    }
                }

                Genealogy genealogy = mTarget.CASGenealogy as Genealogy;

                if (genealogy != null)
                {
                    genealogy.ClearAllGenealogyInformation();
                }

                foreach (SimDescription other in SimDescription.GetSimDescriptionsInWorld())
                {
                    MiniSimDescription miniOther = MiniSimDescription.Find(other.SimDescriptionId);
                    if (miniOther == null)
                    {
                        continue;
                    }

                    miniOther.RemoveMiniRelatioship(mTarget.SimDescriptionId);
                }

                Annihilation.RemoveMSD(mTarget.SimDescriptionId);

                Relationship.RemoveSimDescriptionRelationships(mTarget);

                Urnstone urnstone = Urnstone.FindGhostsGrave(mTarget);

                if (urnstone != null)
                {
                    if ((urnstone.InInventory) && (urnstone.Parent != null) && (urnstone.Parent.Inventory != null))
                    {
                        urnstone.Parent.Inventory.RemoveByForce(urnstone);
                    }

                    urnstone.DestroyGrave();

                    try
                    {
                        urnstone.Dispose();
                    }
                    catch
                    { }
                }

                try
                {
                    mTarget.Dispose();

                    Assassination skill = Assassination.EnsureSkill(mActor);
                    if (skill != null)
                    {
                        skill.AddPotentialKill(mTarget, true);

                        bool witnessed = false;

                        if (lot != null)
                        {
                            witnessed = Assassination.WasWitnessed(lot, roomId, mActor.SimDescription, mTarget, new List <Sim>());
                        }

                        skill.AddActualKill(mTarget, false, witnessed);
                    }
                }
                catch
                { }
            }
Beispiel #11
0
 public void VisitObjectCreation(ObjectCreation node) => InferSimpleType(node.Type);
Beispiel #12
0
 public virtual void VisitObjectCreation(ObjectCreation node)
 {
     node.Arguments?.Accept(this);
 }
Beispiel #13
0
 public void VisitObjectCreation(ObjectCreation node)
 {
     throw new NotImplementedException();
 }
 public static void SetDefaultImageProvider <T>() where T : ImageProviderBase
 {
     DefaultImageProvider = ObjectCreation.GetCreator <T, ImageProviderBase>();
 }
        /// <summary>
        /// IExpressionリスト取得
        /// </summary>
        /// <param name="operation">IOperationインスタンス</param>
        /// <param name="container">イベントコンテナ</param>
        /// <returns>IExpressionリスト</returns>
        public static List <IExpression> GetExpressionList(IOperation operation, EventContainer container)
        {
            List <IExpression> result = new List <IExpression>();

            AbstractOperation instance = null;

            switch (operation)
            {
            // 式系
            case ISimpleAssignmentOperation param:
                instance = new SimpleAssignment(param, container);
                break;

            case IInvocationOperation param:
                instance = new Invocation(param, container);
                break;

            case IBinaryOperation param:
                instance = new Binary(param, container);
                break;

            case IIncrementOrDecrementOperation param:
                instance = new Increment(param, container);
                break;

            case ICompoundAssignmentOperation param:
                instance = new CompoundAssignment(param, container);
                break;

            case IConversionOperation param:
                result.AddRange(GetExpressionList(param.Operand, container));
                break;

            // 参照系
            case IInstanceReferenceOperation param:
                instance = new InstanceReference(param, container);
                break;

            case IFieldReferenceOperation param:
                instance = new FieldReference(param, container);
                break;

            case IPropertyReferenceOperation param:
                instance = new PropertyReference(param, container);
                break;

            case ILocalReferenceOperation param:
                instance = new LocalReference(param, container);
                break;

            case IParameterReferenceOperation param:
                instance = new ParameterReference(param, container);
                break;

            case IArrayElementReferenceOperation param:
                instance = new ArrayElementReference(param, container);
                break;

            case IArgumentOperation param:
                instance = new Argument(param, container);
                break;

            // 生成系
            case IObjectCreationOperation param:
                instance = new ObjectCreation(param, container);
                break;

            case IArrayCreationOperation param:
                instance = new ArrayCreation(param, container);
                break;

            case IArrayInitializerOperation param:
                instance = new ArrayInitializer(param, container);
                break;

            case IVariableDeclaratorOperation param:
                instance = new VariableDeclarator(param, container);
                break;

            // 直値
            case ILiteralOperation param:
                instance = new Literal(param, container);
                break;

            // Switch Case系
            case IDefaultCaseClauseOperation param:
                instance = new DefalutCase(param, container);
                break;

            case IDeclarationPatternOperation param:
                instance = new DeclarationPattern(param, container);
                break;

            //If系
            case IIsPatternOperation param:
                instance = new IsPattern(param, container);
                break;

            case IIsTypeOperation param:
                instance = new IsType(param, container);
                break;


            default:
                Console.Write($" [{operation.Kind} is none] ");
                break;
            }

            // リスト追加
            if (instance != null)
            {
                result.AddRange(instance.Expressions);
            }

            return(result);
        }