Ejemplo n.º 1
0
 //------------------------------------------------AWAKE--------------------------------------
 void Awake()
 {
     //Used for the singleton
     if (m_instance == null)
         m_instance = this;
     else
         Destroy(gameObject);
 }
Ejemplo n.º 2
0
        private void CallGenerator(int XBatches, int YNumbers)
        {
            var input     = new Input(XBatches, YNumbers);
            var generator = new GeneratorManager();

            generator.NumberGenerated += generator_NumberGenerated;

            // Create one thread for Batch
            for (int i = 0; i < input.XBatches; i++)
            {
                var tGeneratorManager = new Thread(generator.Run);
                // Create a new GeneratorInput for Thread to avoid update value of previous thread
                tGeneratorManager.Start(new GeneratorInput(input.YNumbers, i));
            }
        }
Ejemplo n.º 3
0
        private World(string worldName, IWorldSaveFormat format)
        {
            this.Name   = worldName;
            this.Format = format;

            string generatorName = Server.Instance.ServerProperty.WorldGenerator.ToUpper();

            this.Generator = GeneratorManager.GetGenerator(generatorName);
            if (this.Generator == null)
            {
                this.Generator = GeneratorManager.GetGenerator("FLAT");
            }

            //this.Generator = GeneratorManager.GetGenerator("INFINITE");
        }
 protected void OnValidate()
 {
     if (simManager == null)
     {
         simManager = FindObjectOfType <SimulationManager>();
     }
     if (genManager == null)
     {
         genManager = FindObjectOfType <GeneratorManager>();
     }
     if (simulatorSetters == null)
     {
         simulatorSetters = FindObjectOfType <SimulatorSetters>();
     }
 }
Ejemplo n.º 5
0
 protected virtual void Reset()
 {
     if (simManager == null)
     {
         simManager = FindObjectOfType <SimulationManager>();
     }
     if (genManager == null)
     {
         genManager = FindObjectOfType <GeneratorManager>();
     }
     if (simSetters == null)
     {
         simSetters = FindObjectOfType <SimulatorSetters>();
     }
 }
Ejemplo n.º 6
0
        public void OnServerReady(ServerReadyEvent e)
        {
            var searchName = typeof(OpenAPI.OpenApi).Assembly.GetName().Name;

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                if (assembly.GetReferencedAssemblies().Any(x =>
                                                           x.FullName.Contains("MiNET", StringComparison.InvariantCultureIgnoreCase) ||
                                                           x.Name.Equals(searchName)))
                {
                    GeneratorManager.AutoRegister(assembly);
                }
            }

            MultiVerseManager.Load();
        }
    // Start is called before the first frame update
    void Start()
    {
        generators = new List <GeneratorManager>();

        // Create one generator
        GameObject       firstGeneratorObject = new GameObject("Generator0");
        GeneratorManager generator            = firstGeneratorObject.AddComponent <GeneratorManager>();

        generator.effectBoundaries.x = -0.1f;
        generator.effectBoundaries.y = 0.1f;

        // Add to list
        generators.Add(generator);

        // Get mouse cursor
        cursor = GameObject.Find("Cursor");
    }
Ejemplo n.º 8
0
        public string Get()
        {
            //var i = movieservice.GetAll();
            //var client = new WebClient();
            //var content = client.DownloadString("http://localhost:2491/api/SecondaryWebAPI/Generator?Y=3");
            //==== working ====
            GeneratorManager observableGM = new GeneratorManager();
            Processor        observerGM   = new Processor(observableGM);

            MultiplierManager observableMM = new MultiplierManager();
            Processor         observerMM   = new Processor(observableMM);

            observableGM.Value = GetResponse(observableGM.url);
            //observableMM.Value = GetResponse(observableMM.url+ observableGM.Value);

            //return observableMM.Value.ToString();
            return(observableGM.Value.ToString());
        }
Ejemplo n.º 9
0
    public override void OnInspectorGUI()
    {
        manager = (GeneratorManager)target;
        manager.generatorIndex   = EditorGUILayout.Popup("Generator type", manager.generatorIndex, manager.mapGenerators);
        manager.width            = EditorGUILayout.IntField("Map width", manager.width);
        manager.height           = EditorGUILayout.IntField("Map height", manager.height);
        manager.chanceOfDecorate = EditorGUILayout.FloatField("Chance of decorate", manager.chanceOfDecorate);
        manager.floor            = (Tilemap)EditorGUILayout.ObjectField("Tilemap for floor", manager.floor, typeof(Tilemap), true);
        manager.wall             = (Tilemap)EditorGUILayout.ObjectField("Tilemap for walls", manager.wall, typeof(Tilemap), true);
        manager.decoration       = (Tilemap)EditorGUILayout.ObjectField("Tilemap for decoration", manager.decoration, typeof(Tilemap), true);
        manager.floorTile        = (TileBase)EditorGUILayout.ObjectField("Tile for floor", manager.floorTile, typeof(TileBase), false);
        manager.wallTile         = (TileBase)EditorGUILayout.ObjectField("Tile for walls", manager.wallTile, typeof(TileBase), false);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("decorations"), true);
        serializedObject.ApplyModifiedProperties();

        if (clearMap)
        {
            manager.ClearAllMaps();
        }

        switch (manager.generatorIndex)
        {
        case 0:
            TunnelingUI();
            break;

        case 1:
            CellularUI();
            break;

        case 2:
            BSPGenUI();
            break;

        case 3:
            MazeUI();
            break;
        }

        GUILayout.BeginHorizontal();
        buildMap = GUILayout.Button("Generate new map");
        clearMap = GUILayout.Button("Clear map");
        GUILayout.EndHorizontal();
    }
Ejemplo n.º 10
0
    public void trapsOnMapBorderHandler(Toggle t)
    {
        GeneratorManager GM = GeneratorManager.Instance;

        UILineRenderer[] Lines;
        if (t.isOn)
        {
            Lines = GM.DisplayMainMapKeepLines(GM.GeneratorsVect[(int)GM.activeGenerator].getMapWTrapBorder());
        }
        else
        {
            Lines = GM.DisplayMainMapKeepLines(GM.GeneratorsVect[(int)GM.activeGenerator].getMap());
        }

        foreach (UILineRenderer l in Lines)
        {
            l.transform.SetAsLastSibling();
        }
    }
Ejemplo n.º 11
0
        public GeneratorManagerTest() : base()
        {
            MockLoggingService   = new Mock <ILogger <GeneratorManager> >();
            MockGeneratorManager = new Mock <IGeneratorManager>();
            MockProcessorService = new Mock <IProcessorService>();

            MockBatchContext = new Mock <BatchContext>();

            GeneratorManagerUnderTest = new GeneratorManager(MockLoggingService.Object);

            MockSet = new Mock <DbSet <Batch> >();

            var queryable = BatchItems.AsQueryable();

            MockSet.As <IQueryable <Batch> >().Setup(m => m.Provider).Returns(queryable.Provider);
            MockSet.As <IQueryable <Batch> >().Setup(m => m.Expression).Returns(queryable.Expression);
            MockSet.As <IQueryable <Batch> >().Setup(m => m.ElementType).Returns(queryable.ElementType);
            MockSet.As <IQueryable <Batch> >().Setup(m => m.GetEnumerator()).Returns(queryable.GetEnumerator);
        }
Ejemplo n.º 12
0
        public wrapper Get(string _key)
        {
            //var i = movieservice.GetAll();
            //var client = new WebClient();
            //var content = client.DownloadString("http://*****:*****@"[^0-9]", ""));

            //return observableMM.Value.ToString();
            wrapper wrp = new wrapper();

            wrp.key   = _key;
            wrp.value = observableMM.Value.ToString();

            return(wrp);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PickTargetCommand"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private PickTargetCommand(Package package, GeneratorManager manager)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            _package = package;

            if (manager == null)
            {
                throw new ArgumentNullException(nameof(manager));
            }
            _manager = manager;

            OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                var menuItem      = new MenuCommand(this.MenuItemCallback, menuCommandID);
                commandService.AddCommand(menuItem);
            }
        }
Ejemplo n.º 14
0
        public void TrannyLoop()
        {
            while (true)
            {
                var added = DateTime.UtcNow.AddDays(1);
                var dt    = new DateTime(added.Year, added.Month, added.Day, 0, 0, 0);
                var wait  = (dt - DateTime.UtcNow);

                Console.WriteLine("Sleeping until {0} for {1}", dt, wait);

                Thread.Sleep(wait);

                lock (Transactions)
                {
                    Save(true);
                    Transactions.Clear();

                    string filename           = DateTime.Now.ToString("yyyy-MM-dd");
                    string yesterday_filename = DateTime.Now.AddDays(0).ToString("yyyy-MM-dd");

                    File.Move("./transactions", "./transaction-backups/transactions-" + filename);
                    File.Move("./save", "./transaction-backups/save-" + filename);

                    File.Move("./generator", Path.Combine(Config.GetString("generator.directory"), yesterday_filename + "-" + Program.Random.HashedName));
                    File.WriteAllText(Path.Combine(Config.GetString("generator.directory"), "latest.txt"), "http://hexafluoride.dryfish.net/audit-files/" + yesterday_filename + "-" + Program.Random.HashedName);

                    File.Copy(Path.Combine(Config.GetString("generator.directory"), yesterday_filename + "-" + Program.Random.HashedName), Path.Combine(Config.GetString("generator.directory"), "latest"), true);
                    File.WriteAllText(Path.Combine(Config.GetString("generator.directory"), "index.html"), IndexGenerator.FromDirectory(Config.GetString("generator.directory")));
                    Program.Random = GeneratorManager.Create();

                    Console.WriteLine("Cycled out transactions file");
                }

                Thread.Sleep(5000);
            }
        }
Ejemplo n.º 15
0
 void Awake()
 {
     navMeshAgent     = GetComponent <UnityEngine.AI.NavMeshAgent>();
     generatorManager = FindObjectOfType <GeneratorManager>();
 }
Ejemplo n.º 16
0
 void Awake()
 {
     Instance = this;
 }
 void Start()
 {
     parentManager = transform.parent.GetComponent<GeneratorManager>();
     StartCoroutine (TryToReplicate ());
 }
Ejemplo n.º 18
0
 private void Awake()
 {
     BestScore   = PlayerPrefs.GetInt(BestScorePref, 0);
     GamesPlayed = PlayerPrefs.GetInt(GameNumberPref, 0);
     generator   = FindObjectOfType <GeneratorManager>();
 }
Ejemplo n.º 19
0
        static void Main(string[] args)
        {
            Name = "finance";
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

            Commands = new Dictionary <string, MessageHandler>()
            {
                //{"", CheckForExpression },
                { ".give", Give },
                { ".pokies", Bet },
                { ".bene", GetPaid },
                { ".mug", Mug },
                { ".money", GetBalance },
                { ".getsource", GetSource },
                { "$donate", Donate },
                { ".bet", Alias },
                { "$getkey", GetKey },
                { "$setkey", SetKey },
                { "$resetstrs", ResetStrs },
                { ".bot", SetBot },
                { ".human", SetHuman },
                { ".delete", Delete },
                { "$stats", GetStats },
                { ".stats", GetStats },
                { "$writestats", WriteFile },
                { "$writebots", WriteBots },
                { "$botwealth", BotWealth },
                { "$deletebots", RedistributeBotMoney },
                { "$recalculate", RecalculateTable },
                { ".rankcost", GetBalanceForRank },
                { "$draw", DrawLottery },
                { ".buytickets", BuyTickets },
                { "$startlottery", StartLottery },
                { ".chance", GetChance },
                { "$distribute", DistributeAmount },
                { ".rigreport", RigReport },
                { "$addexpr", AddToExpression },
                { "$execute", ExecuteExpression },
                { "$startexpr", StartTyping },
                { "$dumplist", DumpList },
                { "$dumptranslations", DumpTranslations },
                { ".fair", ProvablyFair },
                { "$dumpgenerator", DumpGenerator },
                { "$reindex", Reindex },
            };

            Manager.Load();
            LotteryManager.Load();
            new Thread(new ThreadStart(Manager.TrannyLoop)).Start();
            StringManager.SetStrings();

            string filename = "./generator";

            if (File.Exists(filename))
            {
                Random = RandomGenerator.FromFile(filename);
            }
            else
            {
                Random = GeneratorManager.Create();
            }

            string query = "";

            //while(true)
            //{
            //    string line = Console.ReadLine();
            //    if (string.IsNullOrWhiteSpace(line))
            //    {
            //        IFilter filter = new FilterInstance<Transaction>(Manager.Transactions.ToList());

            //        object result = null;

            //        foreach (var action in query.Split('\n'))
            //        {
            //            if (string.IsNullOrWhiteSpace(action))
            //                continue;

            //            var pair = filter.Apply(new Clause(action.Split(' ')[0], string.Join(" ", action.Split(' ').Skip(1))));

            //            if (pair.Key == 0)
            //                filter = (IFilter)pair.Value;
            //            else if (pair.Key == 1)
            //                result = pair.Value;
            //        }

            //        if (result is IEnumerable<object>)
            //        {
            //            foreach (var obj in (result as IEnumerable<object>))
            //                Console.WriteLine(obj);
            //        }
            //        else
            //            Console.WriteLine(result.ToString());

            //        query = "";
            //    }
            //    else
            //        query += line + "\n";
            //}

            Init(args, delegate
            {
            });
        }
Ejemplo n.º 20
0
    public void loadAliasParamsInParamManager(GameObject ParamsContainer)
    {
        GeneratorManager genM = GeneratorManager.Instance;
        ParameterManager p    = ParameterManager.Instance;

        TMP_InputField[] InpFields = ParamsContainer.GetComponentsInChildren <TMP_InputField>();
        Toggle[]         tS        = ParamsContainer.GetComponentsInChildren <Toggle>();
        TMP_Dropdown[]   DropsD    = ParamsContainer.GetComponentsInChildren <TMP_Dropdown>();

        //Save map params
        p.MapToPlay = (GeneratorUIManager.Instance.isTrapsOnMapBorderToggleOn() ? genM.GeneratorsVect[(int)genM.activeGenerator].getMapWTrapBorder() : genM.GeneratorsVect[(int)genM.activeGenerator].getMap());


        p.rndSeed   = genM.GeneratorsVect[(int)genM.activeGenerator].seed;
        p.GridType  = genM.GeneratorsVect[(int)genM.activeGenerator].TypeGrid;
        p.StartCell = genM.GeneratorsVect[(int)genM.activeGenerator].startPos;
        p.EndCell   = genM.GeneratorsVect[(int)genM.activeGenerator].endPos;

        //Save alias generation params
        p.aliasNum                = Int32.Parse(InpFields[0].text);
        p.minStepsSolution        = Int32.Parse(InpFields[1].text);
        p.maxStepsSolution        = p.minStepsSolution;// metto max uguale a min perchè attualmente l'impatto è poco influente data la natura generativa della creazione delle mappe
        p.allowAutosolverForAlias = tS[0].isOn;

        p.isOptimizerOn = tS[1].isOn;

        if (DropsD[0].value == 0)
        {
            p.considerSimilar = true;
            p.considerNovelty = false;
        }
        else if (DropsD[0].value == 1)
        {
            p.considerSimilar = false;
            p.considerNovelty = true;
        }
        else if (DropsD[0].value >= 2)
        {
            p.considerSimilar = true;
            p.considerNovelty = true;
        }

        if (DropsD[1].value == 0)
        {
            p.isBestPathOnlyExplorative = true;
        }
        else if (DropsD[1].value == 1)
        {
            p.isBestPathOnlyExplorative = false;
            p.onlyBestPath = true;
        }
        else if (DropsD[1].value == 2)
        {
            p.isBestPathOnlyExplorative = false;
            p.onlyBestPath = false;
        }


        if (p.isOptimizerOn)
        {
            p.optimizerType       = DropsD[2].value;
            p.hillClimberNumBatch = Int32.Parse(InpFields[2].text);
            p.timeCap             = Int32.Parse(InpFields[3].text);
        }
    }
Ejemplo n.º 21
0
 public void  InitUIPVC()
 {
     genM = GeneratorManager.Instance;
 }
Ejemplo n.º 22
0
 void Awake()
 {
     GeneratorManager.main = this;
     Init();
 }
 private void Start()
 {
     ValueText = GetComponent <TMP_InputField>();
     genM      = GeneratorManager.Instance;
 }
Ejemplo n.º 24
0
 private void Awake()
 {
     manager = GetComponent <GeneratorManager>();
 }
Ejemplo n.º 25
0
        //cannot create a new ITypeMember and add the Type to it
        public void GenerateMembers <T>(TypeResolver resolver, ITypeMember typeMember, IEnumerable <T> members, GeneratorManager Generators) where T : MemberInfo
        {
            foreach (var m in members)
            {
                var generator = Generators.GeneratorFor(m);
                var member    = generator.Generate(m, resolver);
                if (member != null)
                {
                    RtNode wrapperNode = null;
                    switch (m.MemberType)
                    {
                    case MemberTypes.Field:
                        wrapperNode = new ReflectionAttachedRtField(member as RtField, m as FieldInfo);
                        break;

                    case MemberTypes.Property:
                        wrapperNode = new ReflectionAttachedRtField(member as RtField, m as PropertyInfo);
                        break;

                    case MemberTypes.Method:
                        wrapperNode = new ReflectionAttachedRtFunction(member as RtFunction, m as MethodInfo);
                        break;

                    case MemberTypes.Constructor:
                        wrapperNode = new ReflectionAttachedRtConstructor(member as RtConstructor, m as ConstructorInfo);
                        break;
                    }
                    typeMember.Members.Add(wrapperNode);
                }
            }
        }
Ejemplo n.º 26
0
 /// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 public static void Initialize(Package package, GeneratorManager manager)
 {
     Instance = new PickTargetCommand(package, manager);
 }
Ejemplo n.º 27
0
 void Start()
 {
     timer     = 3.0f;
     generator = GameObject.FindGameObjectWithTag("Generator").GetComponent <GeneratorManager>();
 }
 /// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 public static void Initialize(Package package, IShowAll viewModel, GeneratorManager manager)
 {
     Instance = new PreviewWindowCommand(package, viewModel, manager);
 }
Ejemplo n.º 29
0
 private void Awake()
 {
     manager    = FindObjectOfType <RunnerManager>();
     genManager = FindObjectOfType <GeneratorManager>();
 }