コード例 #1
0
        public QuestTest()
        {
            InitializeComponent();

            creoUpDown.SelectedIndex = DefaultCreoChannel;
            mainUpDown.SelectedIndex = DefaultMainChannel;
            cpuUpDown.SelectedIndex  = DefaultCpuChannel;

            _fusesSub    = new FusesSub(this);
            _gagarinSub  = new GagarinSub(this);
            _sputnikSub  = new SputnikSub(this);
            _creoDoorSub = new CreoDoorSub(this);
            _creoBoxSub  = new CreoBoxSub(this);
            _airSub      = new AirSub(this);
            _tankSub     = new TankSub(this);
            _manipSub    = new ManipSub(this);
            _cpuPanelSub = new CpuPanelSub(this);
            _argonBoxSub = new ArgonBoxSub(this);
            _consoleSub  = new ConsoleSub(this);

            _fusesSub.Run();
            _gagarinSub.Run();
            _sputnikSub.Run();
            _creoDoorPub.Run();
            _resetPub.Run();
            _creoDoorSub.Run();
            _creoBoxSub.Run();
            _acriLightPub.Run();
            _airSub.Run();
            _tankPub.Run();
            _manipSub.Run();
            _tankSub.Run();
            _cpuDoorPub.Run();
            _cpuPanelSub.Run();
            _cpuPanelPub.Run();
            _mainLightPub.Run();
            _argonBoxSub.Run();
            _consoleSub.Run();
            _sputnikPub.Run();

            Init();

            _audioMgr = new RoomAudioManager(creoMgr, mainMgr, cpuMgr);
            new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;
                creoMgr.Run();
            }).Start();
            new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;
                mainMgr.Run();
            }).Start();
            new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;
                cpuMgr.Run();
            }).Start();
            _audioMgr.OnPlayRequest += _audioMgr_OnPlayRequest;
        }
コード例 #2
0
        public void Start()
        {
            // pub.PubOp(calc);

            /*  string userInput="end";
             * try
             * {*/

            var pub = new ConsolePub();
            var sub = new ConsoleSub(pub);

            while (true)
            {
                Console.WriteLine("Please choose an operation(+,-,/,*,>/ for square root, ^2 for squaring the number), or view the history of calculations with 'History', and change the history with 'Modify History'");
                string userInput = Console.ReadLine();
                int    count     = 0;
                //  userInput = calc.GetOperation();
                //change cases to call methods in pub
                // Console.WriteLine(e.Message);

                /*    }
                 *  catch(Exception e)
                 *  {
                 *      pub.PubFailed(e);
                 *  }*/

                Calculation calc = new Calculation();

                switch (userInput)
                {
                case "+":
                    calc.SetOperation(userInput);
                    pub.PubAdd(getInput(calc), userInput);
                    break;

                case "-":
                    calc.SetOperation(userInput);
                    pub.PubSub(getInput(calc), userInput);
                    break;

                case "/":
                    calc.SetOperation(userInput);
                    pub.PubDiv(getInput(calc), userInput);
                    break;

                case "*":
                    calc.SetOperation(userInput);
                    pub.PubMult(getInput(calc), userInput);
                    break;

                case ">/":
                    calc.SetOperation(userInput);
                    pub.PubSqrt(getInput(calc), userInput);
                    break;

                case "^2":
                    calc.SetOperation(userInput);
                    pub.PubPow(getInput(calc), userInput);
                    break;

                case "History":
                    //pub.PubHist(calc, userInput);
                    InputHistory.GetInstance().ViewHistory();
                    break;

                case "Modify History":
                    ChangeHistory hist = new ChangeHistory();
                    hist.CHistory(count);
                    break;

                case "end":
                    System.Environment.Exit(1);
                    break;

                default:
                    Console.WriteLine("Invalid operation. Enter a valid operation");
                    break;
                }
            }
        }