Пример #1
0
    // Use this for initialization
    void Start()
    {
        // Makes the GameManager a Singleton
        if (gameManager == null)
        {
            gameManager = this;
        }
        else if (gameManager != this)
        {
            Destroy(gameObject);
        }

        Texture2D Triangle = (Texture2D)Resources.Load("StartCity");//new Texture2D(128, 128, TextureFormat.RGBA32, false);

        Cursor.SetCursor(Triangle, new Vector2(0, 0), CursorMode.Auto);

        DontDestroyOnLoad(gameObject);

        // Initializes the game
        boardScript = gameManager.GetComponent <BoardManager>();
        InitGame();

        if (escena != "SetUp")
        {
            InputOutputManager.SaveTimeStamp(escena);
        }
    }
        static void Main(string[] args)
        {
            IInputOutputManager inputOutputManger = new InputOutputManager();
            IUserDialogManager  dialogManager     = new UserDialogManager(inputOutputManger);

            IHttpResponseProvider httpResponseProvider = new HttpResponseProvider();
            IHtmlCrawler          htmlCrawler          = new HtmlCrawler();

            SiteCopyingManager siteCopyingManager = new SiteCopyingManager(httpResponseProvider, htmlCrawler);

            try
            {
                //var outputPath = dialogManager.GetInputDirectoryPath();
                //var siteUri = dialogManager.GetSiteUri();
                //var depth = dialogManager.GetDepthNumber();
                //var limits = dialogManager.GetTransitionToOtherDomainsLimits();
                //var extensionsToExclude = dialogManager.GetFileExtensionsToExclude();

                siteCopyingManager.SiteNodeFounded            += dialogManager.DisplaySiteNodeFoundMessage;
                siteCopyingManager.SiteNodeCopiedToFileSystem += dialogManager.DisplaySiteNodeCopiedToFileSystemStepCompletedMessage;

                //siteCopyingManager.CopySite(siteUri, outputPath, depth, limits, extensionsToExclude);
                siteCopyingManager.CopySite("https://news.tut.by/top5news/", @"D:\ExclusiveTutBy", 1);
            }
            catch (Exception exc)
            {
                dialogManager.DisplayExceptionMessage(exc);
            }
            finally
            {
                dialogManager.DisplayOperationFinishedMessage();
                dialogManager.DisplayWaitMessage();
            }
        }
Пример #3
0
    /// <summary>
    /// In case of an error: Skip trial and go to next one.
    /// Example of error: Not enough space to place all items
    /// </summary>
    /// Receives as input a string with the errorDetails which is saved in the output file.
    public static void errorInScene(string errorDetails)
    {
        Debug.Log(errorDetails);
        BoardManager.keysON = false;
        int answer    = 3;
        int randomYes = -1;

        InputOutputManager.save("", answer, GameManager.totalTime, randomYes, errorDetails);
        GameManager.changeToNextTrial();
    }
        public override void Execute()
        {
            if (Data.Length != 2)
            {
                throw new InvalidCommandException(Input);
            }
            string relPath = Data[1];

            InputOutputManager.ChangeCurrentDirectoryRelative(relPath);
        }
Пример #5
0
 //To pause press alt+p
 //Pauses/Unpauses the game. Unpausing take syou directly to next trial
 //Warning! When Unpausing the following happens:
 //If paused/unpaused in scene 1 or 2 (while items are shown or during answer time) then saves the trialInfo with an error: "pause" without information on the items selected.
 //If paused/unpaused on ITI or IBI then it generates a new row in trial Info with an error ("pause"). i.e. there are now 2 rows for the trial.
 public static void pauseManager()
 {
     if ((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) && Input.GetKeyDown(KeyCode.P))
     {
         Time.timeScale = (Time.timeScale == 1) ? 0 : 1;
         if (Time.timeScale == 1)
         {
             InputOutputManager.errorInScene("Pause");
         }
     }
 }
Пример #6
0
        public override void Execute()
        {
            if (Data.Length != 2)
            {
                throw new InvalidCommandException(Input);
            }

            string folderName = Data[1];

            InputOutputManager.CreateDirectoryInCurentFolder(folderName);
        }
Пример #7
0
    public static void Main()
    {
        IInputOutputManager inputOutputManager = new InputOutputManager();
        ICommandDispatcher  commandDispatcher  = new CommandDispatcher();
        IWeaponFactory      weaponFactory      = new WeaponFactory();
        IGemFactory         gemFactory         = new GemFactory();

        IEngine engine = new Engine(inputOutputManager, commandDispatcher, weaponFactory, gemFactory);

        engine.Run();
    }
Пример #8
0
 public override void Execute()
 {
     if (Data.Length == 2)
     {
         string absolutePath = Data[1];
         InputOutputManager.ChangeCurrentDirectoryAbsolute(absolutePath);
     }
     else
     {
         throw new InvalidCommandException(Input);
     }
 }
        public static void Main()
        {
            IReader             consoleReader      = new ConsoleReader();
            IWriter             consoleWriter      = new ConsoleWriter();
            IInputOutputManager inputOutputManager = new InputOutputManager(consoleReader, consoleWriter);

            IStrategyHolder   strategyHolder   = new StrategyHolder(new Dictionary <Type, IGarbageDisposalStrategy>());
            IGarbageProcessor garbageProcessor = new GarbageProcessor(strategyHolder);
            IGarbageFactory   garbageFactory   = new GarbageFactory();
            IRecyclingManager recyclingManager = new RecyclingManager(garbageProcessor, garbageFactory);

            IRunnable engine = new Engine(inputOutputManager, recyclingManager);

            engine.Run();
        }
Пример #10
0
    //Takes care of changing the Scene to the next one (Except for when in the setup scene)
    public static void changeToNextScene(List <Vector3> itemClicks, int answer, int randomYes, int skipped)
    {
        BoardManager.keysON = false;
        if (escena == "SetUp")
        {
            Debug.Log("SetUp");

            InputOutputManager.loadGame();
            SceneManager.LoadScene("Trial");
        }
        else if (escena == "Trial")
        {
            Distancetravelled = BoardManager.distanceTravelledValue;

            if (skipped == 1)
            {
                timeSkip = timeQuestion - tiempo;
            }
            else
            {
                timeSkip = timeQuestion;
            }

            SceneManager.LoadScene("TrialAnswer");
        }
        else if (escena == "TrialAnswer")
        {
            string itemsSelected = extractItemsSelected(itemClicks);
            InputOutputManager.save(itemsSelected, answer, timeSkip, randomYes, "");
            if (answer != 2)
            {
                InputOutputManager.saveTimeStamp("ParticipantAnswer");
            }
            InputOutputManager.saveClicks(itemClicks);
            SceneManager.LoadScene("InterTrialRest");
        }
        else if (escena == "InterTrialRest")
        {
            changeToNextTrial();
        }
        else if (escena == "InterBlockRest")
        {
            SceneManager.LoadScene("Trial");
        }
    }
Пример #11
0
 public override void Execute()
 {
     if (Data.Length == 1)
     {
         InputOutputManager.TraverseDirectory(0);
     }
     else if (Data.Length == 2)
     {
         int  depth;
         bool hasParsed = int.TryParse(Data[1], out depth);
         if (hasParsed)
         {
             InputOutputManager.TraverseDirectory(depth);
         }
         else
         {
             throw new InvalidCommandException(this.Input);
         }
     }
 }
Пример #12
0
        public override void Execute()
        {
            if (this.Data.Length == 1)
            {
                this.InputOutputManager.TraverseDirectory(0);
            }
            else if (Data.Length == 2)
            {
                int  depth;
                bool hasParsed = int.TryParse(Data[1], out depth);

                if (hasParsed)
                {
                    InputOutputManager.TraverseDirectory(depth);
                }
                else
                {
                    OutputWriter.DisplayException(ExceptionMessages.UnableToParseNumber);
                }
            }
        }
Пример #13
0
    public static gameInstance[] game_instances;    // = new TSPInstance[numberOfInstances];

    // Use this for initialization
    void Awake()
    {
        //Makes the Game manager a Singleton
        if (gameManager == null)
        {
            gameManager = this;
        }
        else if (gameManager != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);

        //Initializes the game
        boardScript = gameManager.GetComponent <BoardManager> ();

        InitGame();
        if (escena != "SetUp")
        {
            InputOutputManager.saveTimeStamp(escena);
        }
    }
Пример #14
0
 // Sets the triggers for pressing the corresponding keys
 // Perhaps a good practice thing to do would be to create a "close scene" function that takes as parameter the answer and closes everything (including keysON=false) and then forwards to
 // changeToNextScene(answer) on game manager
 private void SetKeyInput()
 {
     if (GameManager.escena == "Trial")
     {
         if (Input.GetKeyDown(KeyCode.UpArrow)) //&& SubmissionValid(false))
         {
             InputOutputManager.SaveTimeStamp("ParticipantSkip");
             GameManager.ChangeToNextScene(itemClicks, true);
         }
     }
     else if (GameManager.escena == "SetUp")
     {
         if (Input.GetKeyDown(KeyCode.Space))
         {
             GameFunctions.SetTimeStamp();
             GameManager.ChangeToNextScene(itemClicks, false);
         }
     }
     else
     {
         Debug.Log("Skipped to next scene... I wonder why");
         GameManager.ChangeToNextScene(itemClicks, false);
     }
 }
 InputOutputManager total; //This is where everything will be going down.
 // rewrite the following constructor with a constructor that takes an object
 // to be set to the above field
 public CoinInserter(int p, InputOutputManager t)
 {
     positionInArray = p;
     total           = t;
 }
Пример #16
0
    // Takes care of changing the Scene to the next one (Except for when in the setup scene)
    public static void ChangeToNextScene(List <BoardManager.Click> itemClicks, bool skipped)
    {
        BoardManager.keysON = false;
        if (escena == "SetUp")
        {
            InputOutputManager.LoadGame();
            problemName = problemOrder[currentProblem];
            SceneManager.LoadScene("InterProblemRest");
        }
        else if (escena == "Trial")
        {
            if (skipped)
            {
                timeTaken = timeQuestion - tiempo;
            }
            else
            {
                timeTaken = timeQuestion;
            }

            // Save participant answer
            // Calc Perf
            if ((float)Distancetravelled > 0)
            {
                performance = BoardManager.solution / (float)Distancetravelled;
            }
            else
            {
                performance = 0;
            }


            if ((timedOut == 1 || timedOut == 2) && !BoardManager.SubmissionValid(true))
            {
                performance = 0;
            }

            perf.Add(performance);

            if (problemName == 'w'.ToString())
            {
                pay = Math.Pow(performance, 4.50);
            }

            paylist.Add(pay);

            payAmount += pay;
            Debug.Log("current pay: $" + payAmount);

            InputOutputManager.SaveTrialInfo(ExtractItemsSelected(itemClicks), timeTaken);
            InputOutputManager.SaveTimeStamp("ParticipantAnswer");
            InputOutputManager.SaveClicks(itemClicks);

            // Load next scene
            SceneManager.LoadScene("InterTrialRest");
        }
        else if (escena == "InterTrialRest")
        {
            ChangeToNextTrial();
        }
        else if (escena == "InterBlockRest")
        {
            SceneManager.LoadScene("Trial");
        }
        else if (escena == "InterProblemRest")
        {
            ChangeToNextTrial();
        }
        else if (escena == "End")
        {
            SceneManager.LoadScene("Payment");
        }
    }
Пример #17
0
    //End of Adding Feedback to Model
    #endregion

    void Start()
    {
        #region Getting Initial Position and Rotation
        initialPosition = transform.position;
        initialRotation = transform.rotation;
        #endregion

        #region Initializing Important Variables
        desiredPosition         = Vector3.zero;
        ListOfAffordances       = new List <Affordances>();
        DictionaryOfAffordances = new Dictionary <Affordances.Names, Affordances>();
        DictionaryOfFeedBacks   = new Dictionary <Affordances.Names, FeedBackBase>();
        supportedMediaFormats   = new List <Affordances.MediaTypes>();
        hasChildren             = (transform.childCount > 0);
        Child_MainBody          = transform.FindChild("MainBody");

        Renderer Sub_Renderer = GetComponent <Renderer>() == null?transform.GetChild(0).GetComponent <Renderer>() : GetComponent <Renderer>();

        if (Child_MainBody == null)
        {
            initialTextures     = new Texture[Sub_Renderer.materials.Length];
            initialColors       = new Color[Sub_Renderer.materials.Length];
            initialMaterialName = new string[Sub_Renderer.materials.Length];

            initialMaterials = Sub_Renderer.materials;
            initialMaterial  = Sub_Renderer.material;

            for (int i = 0; i < Sub_Renderer.materials.Length; i++)
            {
                initialTextures[i]     = Sub_Renderer.materials[i].mainTexture;
                initialMaterialName[i] = Sub_Renderer.materials[i].name;
                if (Sub_Renderer.materials[i].HasProperty("_Color"))
                {
                    initialColors[i] = Sub_Renderer.materials[i].color;
                }
            }
            if (Sub_Renderer.material.HasProperty("_Color"))
            {
                initialColor = Sub_Renderer.material.color;
            }
        }
        else
        {
            initialTextures     = new Texture[Child_MainBody.GetComponent <Renderer>().materials.Length];
            initialColors       = new Color[Child_MainBody.GetComponent <Renderer>().materials.Length];
            initialMaterialName = new string[Child_MainBody.GetComponent <Renderer>().materials.Length];

            initialMaterials = Child_MainBody.GetComponent <Renderer>().materials;
            initialMaterial  = Child_MainBody.GetComponent <Renderer>().material;


            for (int i = 0; i < Child_MainBody.GetComponent <Renderer>().materials.Length; i++)
            {
                initialTextures[i]     = Child_MainBody.GetComponent <Renderer>().materials[i].mainTexture;
                initialMaterialName[i] = Child_MainBody.GetComponent <Renderer>().materials[i].name;
                if (Child_MainBody.GetComponent <Renderer>().materials[i].HasProperty("_Color"))
                {
                    initialColors[i] = Child_MainBody.GetComponent <Renderer>().materials[i].color;
                }
            }

            if (Child_MainBody.GetComponent <Renderer>().material.HasProperty("_Color"))
            {
                initialColor = Child_MainBody.GetComponent <Renderer>().material.color;
            }
        }

        #endregion
        #region Finding Refrence to Important Scripts
        Sub_FunctionalityMenuHandler = GameObject.FindObjectOfType <FunctionalityMenuHandler>();
        Sub_LoadingAnimationHandler  = GameObject.FindObjectOfType <LoadingAnimationHandler>();
        Sub_Lollypop = GameObject.FindObjectOfType <Lollypop>();
        Sub_DeviceConnectivityManager = GameObject.FindObjectOfType <InputOutputManager>();
        #endregion

        SetUpColliderAndAffordanceFeedback();

        RecognizingAffordances();
    }
        private void Form1_Load(object sender, EventArgs e)
        {
            amountDisplay = new AmountDisplay(txtAmount);

            displayNum10Yen  = new DebugDisplay(txtNum10Yen);
            displayNum50Yen  = new DebugDisplay(txtNum50Yen);
            displayNum100Yen = new DebugDisplay(txtNum100Yen);
            displayNum500Yen = new DebugDisplay(txtNum500Yen);
            displayPrice0    = new DebugDisplay(txtPrice0);
            displayPrice1    = new DebugDisplay(txtPrice1);
            displayPrice2    = new DebugDisplay(txtPrice2);
            displayPrice3    = new DebugDisplay(txtPrice3);
            displayName0     = new DebugDisplay(txtName0);
            displayName1     = new DebugDisplay(txtName1);
            displayName2     = new DebugDisplay(txtName2);
            displayName3     = new DebugDisplay(txtName3);
            displayNumCans0  = new DebugDisplay(txtNumCan0);
            displayNumCans1  = new DebugDisplay(txtNumCan1);
            displayNumCans2  = new DebugDisplay(txtNumCan2);
            displayNumCans3  = new DebugDisplay(txtNumCan3);

            soldOutLight0 = new Light(pbxSOLight0, Color.Orange);
            soldOutLight1 = new Light(pbxSOLight1, Color.Orange);
            soldOutLight2 = new Light(pbxSOLight2, Color.Orange);
            soldOutLight3 = new Light(pbxSOLight3, Color.Orange);

            noChangeLight = new TimerLight(pbxNoChange, Color.Red, timer1);

            purchasableLight0 = new Light(pbxPurLight0, Color.Aqua);
            purchasableLight1 = new Light(pbxPurLight1, Color.Aqua);
            purchasableLight2 = new Light(pbxPurLight2, Color.Aqua);
            purchasableLight3 = new Light(pbxPurLight3, Color.Aqua);

            coinDispenser10Yen  = new CoinDispenser(txtChange10Yen);
            coinDispenser50Yen  = new CoinDispenser(txtChange50Yen);
            coinDispenser100Yen = new CoinDispenser(txtChange100Yen);
            coinDispenser500Yen = new CoinDispenser(txtChange500Yen);

            // All candispensers share the same output textbox for simulation
            canDispenser0 = new CanDispenser(txtCanDispenser, CANNAMES[0]);
            canDispenser1 = new CanDispenser(txtCanDispenser, CANNAMES[1]);
            canDispenser2 = new CanDispenser(txtCanDispenser, CANNAMES[2]);
            canDispenser3 = new CanDispenser(txtCanDispenser, CANNAMES[3]);

            // You must replace the following default constructors with
            // constructors with arguments (non-default constructors)
            // to pass (set) the first object that ButtonPressed() will
            // visit



            //purchaseButton0 = new PurchaseButton();
            //purchaseButton1 = new PurchaseButton();
            //purchaseButton2 = new PurchaseButton();
            //purchaseButton3 = new PurchaseButton();

            // You must replace the following default constructors with
            // constructors that take armuments to pass the first object that
            // the CoinInserted() will call
            //coinInserter10Yen = new CoinInserter();
            //coinInserter50Yen = new CoinInserter();
            //coinInserter100Yen = new CoinInserter();
            //coinInserter500Yen = new CoinInserter();

            //coinReturnButton = new CoinReturnButton();

            // Instantiate your entity and control objects
            // Connect these objects

            canArr[0] = new Can(120, "Coca-Cola", 4, soldOutLight0, purchasableLight0, canDispenser0, displayNumCans0);
            canArr[1] = new Can(170, "Pepsi", 4, soldOutLight1, purchasableLight1, canDispenser1, displayNumCans1);
            canArr[2] = new Can(130, "Dr.Pepper", 4, soldOutLight2, purchasableLight2, canDispenser2, displayNumCans2);
            canArr[3] = new Can(110, "Sprite", 4, soldOutLight3, purchasableLight3, canDispenser3, displayNumCans3);

            coinArr[0] = new Coin(10, 15, coinDispenser10Yen, displayNum10Yen);
            coinArr[1] = new Coin(50, 10, coinDispenser50Yen, displayNum50Yen);
            coinArr[2] = new Coin(100, 5, coinDispenser100Yen, displayNum100Yen);
            coinArr[3] = new Coin(500, 2, coinDispenser500Yen, displayNum500Yen);
            //Coin[] coinToIOMan = { fiveHundred, oneHundred, fifty, ten };

            total = new InputOutputManager(canArr, coinArr, noChangeLight, amountDisplay);


            coinInserter10Yen  = new CoinInserter(0, total);
            coinInserter50Yen  = new CoinInserter(1, total);
            coinInserter100Yen = new CoinInserter(2, total);
            coinInserter500Yen = new CoinInserter(3, total);
            coinReturnButton   = new CoinReturnButton(total);
            purchaseButton0    = new PurchaseButton(0, total);
            purchaseButton1    = new PurchaseButton(1, total);
            purchaseButton2    = new PurchaseButton(2, total);
            purchaseButton3    = new PurchaseButton(3, total);
            // Display debug information
            displayCanPricesAndNames();
            updateDebugDisplays();
        }
        InputOutputManager total;   //This is needed to connect this all together. The actual logic of this I will have to decide how it works later.

        public CoinReturnButton(InputOutputManager t)
        {
            total = t;
        }
Пример #20
0
 //Sets the triggers for pressing the corresponding keys
 //123: Perhaps a good practice thing to do would be to create a "close scene" function that takes as parameter the answer and closes everything (including keysON=false) and then forwards to
 //changeToNextScene(answer) on game manager
 //necessary: this was imported from decision version
 private void setKeyInput()
 {
     if (GameManager.escena == "Trial")
     {
         if (Input.GetKeyDown(KeyCode.UpArrow))
         {
             InputOutputManager.saveTimeStamp("ParticipantSkip");
             GameManager.changeToNextScene(itemClicks, 0, 0, 1);
         }
     }
     else if (GameManager.escena == "TrialAnswer")
     {
         //1: No/Yes 0: Yes/No
         if (randomYes == 1)
         {
             if (Input.GetKeyDown(KeyCode.LeftArrow))
             {
                 //Left
                 keysON = false;
                 answer = 0;
                 GameObject boto = GameObject.Find("LEFTbutton") as GameObject;
                 BoardFunctions.highlightButton(boto);
                 GameFunctions.setTimeStamp();
                 GameManager.changeToNextScene(itemClicks, 0, 1, 0);
             }
             else if (Input.GetKeyDown(KeyCode.RightArrow))
             {
                 //Right
                 keysON = false;
                 answer = 1;
                 GameObject boto = GameObject.Find("RIGHTbutton") as GameObject;
                 BoardFunctions.highlightButton(boto);
                 GameFunctions.setTimeStamp();
                 GameManager.changeToNextScene(itemClicks, 1, 1, 0);
             }
         }
         else if (randomYes == 0)
         {
             if (Input.GetKeyDown(KeyCode.LeftArrow))
             {
                 //Left
                 keysON = false;
                 answer = 1;
                 GameObject boto = GameObject.Find("LEFTbutton") as GameObject;
                 BoardFunctions.highlightButton(boto);
                 GameFunctions.setTimeStamp();
                 GameManager.changeToNextScene(itemClicks, 1, 0, 0);
             }
             else if (Input.GetKeyDown(KeyCode.RightArrow))
             {
                 //Right
                 keysON = false;
                 answer = 0;
                 GameObject boto = GameObject.Find("RIGHTbutton") as GameObject;
                 BoardFunctions.highlightButton(boto);
                 GameFunctions.setTimeStamp();
                 GameManager.changeToNextScene(itemClicks, 0, 0, 0);
             }
         }
     }
     else if (GameManager.escena == "SetUp")
     {
         if (Input.GetKeyDown(KeyCode.Space))
         {
             GameFunctions.setTimeStamp();
             GameManager.changeToNextScene(itemClicks, 0, 0, 0);
         }
     }
 }
        InputOutputManager total; //This is the main connection to the controller. This is obcjously where everything is going down.

        public PurchaseButton(int p, InputOutputManager t)
        {
            positionInArray = p;
            total           = t;
        }