Exemple #1
1
        public salinha(Conexao con, String dono, String nomeSala)
        {
            this.conexao = con;
            this.dono = dono;
            sala = nomeSala;
            jogadores.Clear();

            InitializeComponent();

            Title = conexao.NomeJogador;
            textBox1.Text = dono;
            textBox9.Text = sala;

            conexao.Send("buscarplayer/" + sala);
            String resposta = conexao.Receive();

            jogador = resposta;

            conexao.Send("jogadoresdasala/" + sala);
            String message = conexao.Receive();
            tratarEvento(message);

            threadRunning = true;
            thread = new Thread(new ThreadStart(RunClient));
            thread.SetApartmentState(ApartmentState.STA);
            thread.IsBackground = true;
            thread.Start();
        }
        public ControlState controlState;                //get and set the control state
        #endregion

        #region constructor/load
        public TacticalBattle(List<Piece> player1Army, List<Piece> player2Army, TacMap map, ContentManager content)
        {
            //p1Avatar = player1;
            //p2Avatar = player2;

            this.player1Army = player1Army;
            this.player2Army = player2Army;

            isPlayer1Turn = true;
            this.map = map;
            battleOver = false;
            gridOn = false;

            mouseVisible = true;
            controlState = ControlState.selectUnit;

            selectedUnit = null;
            status = "Combat begins";
            selectionTiles = new List<Tile>();
            unitInfo = "";
            //load interface items                  TODO
            confirmation = content.Load<Texture2D>("confirmationPopup");
            background = content.Load<Texture2D>("TerrainSprites/battle");
            statusFont = content.Load<SpriteFont>("Arial");
            playerFont = content.Load<SpriteFont>("playerFont");
            infoFont = content.Load<SpriteFont>("infoFont");
            moveBox = content.Load<Texture2D>("TerrainSprites/move");
            targetBox = content.Load<Texture2D>("TerrainSprites/target");
            selectedBox = content.Load<Texture2D>("TerrainSprites/selected");
            horizontal = content.Load<Texture2D>("TerrainSprites/horizontal");
            vertical = content.Load<Texture2D>("TerrainSprites/vertical");
            winBox = content.Load<Texture2D>("Menu/Win message");
            //set units to starting positions
            startingPositions();
        }
Exemple #3
1
        public Boolean fromFile(String path)
        {
            FileStream fs = new FileStream(path, FileMode.Open);
            BinaryReader reader = new BinaryReader(fs);
            try
            {
                String h = reader.ReadString();
                float v = BitConverter.ToSingle(reader.ReadBytes(sizeof(float)), 0);
                drawFloorModel = reader.ReadBoolean();
                showAlwaysFloorMap = reader.ReadBoolean();
                lockMapSize = reader.ReadBoolean();
                mapXsize = reader.ReadInt32();
                mapYsize = reader.ReadInt32();

                //edgeXのxはmapX-1
                //yはmapYsize

                return true;

            }
            catch (EndOfStreamException eex)
            {
                //握りつぶす
                return false;
            }
            finally
            {
                reader.Close();
            }
        }
 public CaptionDef(Point Position, String Text, Color ForeColor, Boolean Visible)
 {
     this.Position = Position;
     this.Text = Text;
     this.ForeColor = ForeColor;
     this.Visible = Visible;
 }
        public Pigeon(ContentManager con)
        {
            boundingBox = new Vector3(6, 3, 6);

            distance = 0;
            rand = new Random();

            dx = (0.5-rand.NextDouble())*0.8 + 0.2;
            dy = rand.NextDouble()*1.5 + 0.7;
            dz = 0.8;

            x = 5.8;
            y = -2;
            z = 83.5;

            sx = 5.8;
            sy = -2;
            sz = 83.5;

            this.world = Matrix.CreateTranslation(new Vector3((float)x, (float)y, (float)z));

            model = con.Load<Model>(@"models/pigeon");

            isDone = false;
        }
 FontWeight ConvertToFontWeight(Boolean bold)
 {
     if (bold) {
         return FontWeights.Bold;
     }
     return FontWeights.Normal;
 }
Exemple #7
1
		public void Update(PlayerButton input, Facing facing, Boolean paused)
		{
			m_inputbuffer.Add(input, facing);

			if (paused == false)
			{
				foreach (BufferCount count in m_commandcount.Values) count.Tick();
			}

			foreach (Command command in Commands)
			{
				if (command.IsValid == false) continue;

				if (CommandChecker.Check(command, m_inputbuffer) == true)
				{
					Int32 time = command.BufferTime;
					if (paused == true) ++time;

					m_commandcount[command.Name].Set(time);
				}
			}

			m_activecommands.Clear();
			foreach (var data in m_commandcount) if (data.Value.IsActive == true) m_activecommands.Add(data.Key);
		}
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            _isNewPageInstance = true;
            mainPageModel = new MainPageModel();


            DateTime dateTemp = (DateTime)datePicker1.Value;
            date = dateTemp.ToString("yyyyMMdd");
            System.Diagnostics.Debug.WriteLine("date in Constructor: " + date + ", " + dateTemp.ToString());

            DateTime timeTemp = (DateTime)timePicker1.Value;
            time = timeTemp.ToString("HHmm");
            System.Diagnostics.Debug.WriteLine("time in Constructor: " + time + ", " + timeTemp.ToString());
           
            timetype = "departure";

            isFromTextBox = true;
            System.Diagnostics.Debug.WriteLine("isFromTextBox in constructor: " + isFromTextBox);

            fromToAddressRequestResult = new List<Geocoding>();
            stopsInAreaRequestResult = new List<StopsInArea>();

            coordsList = new List<String>();

            //location
            if (watcher == null)
            {
                watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
                watcher.MovementThreshold = 20;
                watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(watcher_StatusChanged);
                watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged);
                watcher.Start();
            }
        }
Exemple #9
1
        public Config()
        {
            //check if there is any config file, if not create a new one with some defaults...
            if (File.Exists(AppPath + "\\dufftv.ini"))
            {
                //declare new source ini file
                source = new IniConfigSource(AppPath + "\\dufftv.ini");

                //turn on autosaving, no need to save manually
                source.AutoSave = true;

                // Creates two Boolean aliases.
                source.Alias.AddAlias("On", true);
                source.Alias.AddAlias("Off", false);

                _Version = source.Configs["defaults"].GetString("Version");
                _AutoUpdate = source.Configs["defaults"].GetBoolean("AutoUpdate", false);
                _ConnectionCheckURI = source.Configs["defaults"].GetString("ConnectionCheckURI", "http://www.google.se");
                _LastUpdate = _Version = source.Configs["defaults"].GetString("LastUpdate");
                _IconSize =  source.Configs["defaults"].GetInt("IconSize");
                _XMLTVSourceURI = source.Configs["xmltv"].GetString("SourceURI");
                _Country = source.Configs["xmltv"].GetString("Country");
                _ChannelList = source.Configs["xmltv"].Get("ChannelList").Split('|');

                _CreatedNewFile = false;
            }
            else
            {
                CreateNewConfigFile();
            }
        }
        /// <summary>Gets REST url.</summary>
        /// <param name="urlKey">Url key.</param>
        /// <param name="addClientId">Denotes whether client identifier should be composed into final url.</param>
        /// <param name="pagination">Pagination object.</param>
        /// <param name="additionalUrlParams">Additional parameters.</param>
        /// <returns>Final REST url.</returns>
        public String GetRestUrl(String urlKey, Boolean addClientId, Pagination pagination, Dictionary<String, String> additionalUrlParams)
        {
            String url;

            if (!addClientId)
            {
                url = "/v2.01" + urlKey;
            }
            else
            {
                url = "/v2.01/" + _root.Config.ClientId + urlKey;
            }

            bool paramsAdded = false;
            if (pagination != null)
            {
                url += "?page=" + pagination.Page + "&per_page=" + pagination.ItemsPerPage;
                paramsAdded = true;
            }

            if (additionalUrlParams != null)
            {
                foreach (string key in additionalUrlParams.Keys)
                {

                    url += paramsAdded ? Constants.URI_QUERY_PARAMS_SEPARATOR : Constants.URI_QUERY_SEPARATOR;
                    url += key + "=" + Uri.EscapeDataString(additionalUrlParams[key]);
                    paramsAdded = true;
                }
            }

            return url;
        }
Exemple #11
1
        //public:
        public Bullet(Double x_, Double y_, Int32 width_, Int32 height_, Int32 damage_, BulletKind kind_)
        {
            PosX = x_;
            PosY = y_;
            Width = width_;
            Height = height_;
            switch (kind_)
            {
                case BulletKind.Laser:
                    {
                        _type = BulletType.Laser;
                        break;
                    }
                case BulletKind.Exploded:
                    {
                        _type = BulletType.Exploded;
                        break;
                    }
                case BulletKind.Rocket:
                    {
                        _type = BulletType.Rocket;
                        break;
                    }
            }
            Damage = damage_+_type._bonusdamage;
            _active = true;

            _vx = 1; _vy = 0;
            _speed = _type.speed;
        }
Exemple #12
1
 private void Begin_Click(object sender, EventArgs e)
 {
     Begin.Text = "开始...";
     Begin.Enabled = false;
     start = true;
     List<Task> listTask = new List<Task>();
     TaskFactory tskf = new TaskFactory();
     var controls = groupBox.Controls;
     foreach (var control in controls)
     {
         if (control.GetType() != typeof(Label))
         {
             continue;
         }
         var label = control as Label;
         listTask.Add(tskf.StartNew(new Action(() =>
         {
             while (start)
             {
                 Thread.Sleep(200);
                 var text = GeNum(label);
                 UpdateLabl(label, text);
                 //Console.WriteLine("label:[{0}],value:[{1}]", label.Name, text);
             }
         })));
     }
     tskf.ContinueWhenAll(listTask.ToArray(), (rest) => { ShowMessage(); });
     //MessageBox.Show("主线程结束了。。。", "结果");
     Thread.Sleep(1000);
     End.Enabled = true;
 }
Exemple #13
1
        public Platform(int x, int y, Type type, Texture2D texture, Boolean bottomCollision)
            : base(x, y, texture)
        {
            this.bottomCollision = bottomCollision;

            this.type = type;
        }
Exemple #14
0
 public void UpdateProfile(Repeater rpData, Boolean debugMode = false)
 {
     const string profileupload = "NBStore\\profileupload";
     Utils.CreateFolder(PortalSettings.Current.HomeDirectoryMapPath + profileupload);
     var strXml = GenXmlFunctions.GetGenXml(rpData, "", PortalSettings.Current.HomeDirectoryMapPath + profileupload);
     Save(strXml, debugMode);
 }
Exemple #15
0
        void Init(String domainName, String connStringName, Boolean pSecure, bool chekControllers)
        {
            //_LdapWrapper = new LdapWrapper();

            //LoadControllersFromDatabase( pConnString);


            _DomainUrlInfo = DomainsUrl_Get_FromSp(connStringName, domainName);// _DomainUrlInfoList.First<DomainUrlInfo>(p => p.DomainName == domainName);
            if (_DomainUrlInfo == null)
            {
                throw new Fwk.Exceptions.TechnicalException("No se encontró la información del dominio especificado");
            }

            if (chekControllers)
            {
                _DomainControllers = GetDomainControllersByDomainId(System.Configuration.ConfigurationManager.ConnectionStrings[connStringName].ConnectionString, _DomainUrlInfo.Id);
                if (_DomainControllers == null || _DomainControllers.Count == 0)
                    throw new Fwk.Exceptions.TechnicalException("No se encuentra configurado ningún controlador de dominio para el sitio especificado.");


                // Prueba de conectarse a algún controlador de dominio disponible, siempre arranando del primero. debería 
                // TODO: reemplazarse por un sistema de prioridad automática para que no intente conectarse primero a los funcionales conocidos
                //LdapException wLastExcept = GetDomainController(pSecure, _DomainControllers);
                if (_DomainController == null)
                {
                    throw new Fwk.Exceptions.TechnicalException("No se encontró ningún controlador de dominio disponible para el sitio especificado.");//, wLastExcept);
                }
            }
        }
        /// <summary>
        /// Recursively goes through all files in the directory 
        /// and adds them to the MyFilesDB
        /// </summary>
        /// <param name="directory">Current Directory To Search</param>
        private void addDirectory(String directory)
        {
            try
            {
                foreach (String file in Directory.GetFiles(directory))
                {
                    myFilesDb.AddFile(file);
                    DataGridViewRow row = new DataGridViewRow();
                    DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();
                    cell.Value = "Hashed: " + file;
                    row.Cells.Add(cell);
                    if (isShown && !gvLog.IsDisposed && !this.IsDisposed)
                    {
                        try
                        {
                            this.Invoke(new MethodInvoker(
                                    delegate()
                                    {
                                        gvLog.Rows.Insert(0, row);
                                    }));
                        }
                        catch { isShown = false; }
                    }

                }
            }
            catch { }

            foreach (String nextDir in Directory.GetDirectories(directory))
            {
                addDirectory(nextDir);
            }
        }
   //     public class CloseDetector
   //     {
            private void Detector() //ExtendedWebBrowser ewb) 
            {
                while (true && !closing) 
                {
                    try 
                    {
                        //MessageBox.Show("get document!" + this + " : " + uiDocument);

                        //var document = wb.Document;
                        //MessageBox.Show("got document! " + document);
                        var idselectDone = uiDocument.GetElementById("idselectDone");

                        //MessageBox.Show("IN LOOP! " + " : " + idselectDone);
                        if (idselectDone != null) 
                        {
                            //closing = true;
                            //MessageBox.Show("Closing!");
                            closing = true;
                        } 
                        else
                        {
                            Thread.Sleep(200);
                        } 
                    } catch(Exception e)
                    {
                        MessageBox.Show("Detector Exception : " + e);
                        closing = true;
                    }
                    // 
                }
                Closing(this, EventArgs.Empty);
           }
 protected Configuration(ConfigurationType type, string name, Boolean standard)
 {
     Name = name;
     Type = type;
     Standard = standard;
     ID = name;
 }
Exemple #19
0
 /// <summary>
 /// Function to enable or not the fields to modify the connection string to the SQL server.
 /// </summary>
 /// <param name="IsEnabled"></param>
 private void IsFormEnabled(Boolean IsEnabled)
 {
     this.txtServerName.IsEnabled = IsEnabled;
     this.txtDBName.IsEnabled = IsEnabled;
     this.txtUserID.IsEnabled = IsEnabled;
     this.txtPassword.IsEnabled = IsEnabled;
 }
        internal void PersistFile(Web web, ProvisioningTemplateCreationInformation creationInfo, PnPMonitoredScope scope, string folderPath, string fileName, Boolean decodeFileName = false)
        {
            if (creationInfo.FileConnector != null)
            {
                SharePointConnector connector = new SharePointConnector(web.Context, web.Url, "dummy");

                Uri u = new Uri(web.Url);
                if (folderPath.IndexOf(u.PathAndQuery, StringComparison.InvariantCultureIgnoreCase) > -1)
                {
                    folderPath = folderPath.Replace(u.PathAndQuery, "");
                }

                using (Stream s = connector.GetFileStream(fileName, folderPath))
                {
                    if (s != null)
                    {
                        creationInfo.FileConnector.SaveFileStream(decodeFileName ? HttpUtility.UrlDecode(fileName) : fileName, s);
                    }
                }
            }
            else
            {
                WriteWarning("No connector present to persist homepage.", ProvisioningMessageType.Error);
                scope.LogError("No connector present to persist homepage");
            }
        }
        public static void initSimulation(Airport.Airport airport, Boolean enableMultiThreading)
        {
            Simulation.airport = airport;
            Simulation.multiThreadingEnabled = enableMultiThreading;

            Console.ForegroundColor = ConsoleColor.White;
        }
        public void buildDictionary()
        {
            buildLock = true;
            trie = new Trie();

            if (!sender.IsAlive)
            {
                sender.Start();
            }

            PerformanceCounter ramCounter = new PerformanceCounter("Memory", "Available MBytes");

            if (table.Exists())
            {
                TableQuery<IndexIdentity> query = new TableQuery<IndexIdentity>()
                   .Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "indexingforsearch"));

                string title = "Done building dictionary";

                foreach (IndexIdentity e in table.ExecuteQuery(query))
                {
                    if (ramCounter.NextValue() >= 40)
                    {
                        string line = e.RowKey;
                        trie.Add(line);
                        trieSize++;
                        lastTitle = line;
                    }
                }

                HttpContext.Current.Response.Write(title);
            }

            buildLock = false;
        }
Exemple #23
0
        public void EnsureArgumentNotEmpty(IEnumerable argument, Boolean shouldCorrupt)
        {
            try
            {
                // ReSharper disable once PossibleMultipleEnumeration
                Ensure.ArgumentNotEmpty(argument, "argument");
                Assert.False(shouldCorrupt);
            } catch (ArgumentNullException)
            {
                throw new InvalidOperationException("Unexpected exception.");
            } catch (ArgumentException)
            {
                Assert.True(shouldCorrupt);
            }

            try
            {
                // ReSharper disable once PossibleMultipleEnumeration
                Ensure.ArgumentNotEmpty(argument, "argument", "Argument should not be null.");
                Assert.False(shouldCorrupt);
            } catch (ArgumentNullException)
            {
                throw new InvalidOperationException("Unexpected exception.");
            } catch (ArgumentException)
            {
                Assert.True(shouldCorrupt);
            }
        }
Exemple #24
0
 public TicTacToeTransaction(String[,] board, int x, int y, Boolean playerXTurn)
 {
     this.board = board;
     this.x = x;
     this.y = y;
     this.playerXTurn = playerXTurn;
 }
        private void button3_Click(object sender, EventArgs e)
        {
            signal = false;
            button1.Enabled = false;

            //calculate smallesy Y
            findSnallestY();

            //Generate Angle array

            createAngleArray();

            //Sort angle array
            sortAngleArray();

            //find smallest polygon

            findSmallestPolygon();

            button3.Enabled = false;

            string final = " "+pointName[0];
            Point p;

            for (int i = 1; i < count; i++)
              {
                  if (finalPointArray[i] == 1)
                  {

                      final = final + " , " + " " + " " + pointName[i] + " ";
                  }
              }

                richTextBox1.Text = "Smallest Polygon's Points Are \n" + " ("+final+ " )";
        }
		public HistoryItem (String notificationName, String text)
		{
			this.NotificationName = notificationName;
			this.Text = text;
			this.Date = DateTime.Now;
			this.Read = false;
		}
Exemple #27
0
 /// <summary>
 /// Run FlashDevelop and catch any unhandled exceptions.
 /// </summary>
 static void RunFlashDevelopWithErrorHandling(String[] arguments, Boolean isFirst)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     MainForm.IsFirst = isFirst;
     MainForm.Arguments = arguments;
     MainForm mainForm = new MainForm();
     SingleInstanceApp.NewInstanceMessage += delegate(Object sender, Object message)
     {
         MainForm.Arguments = message as String[];
         mainForm.ProcessParameters(message as String[]);
     };
     try
     {
         SingleInstanceApp.Initialize();
         Application.Run(mainForm);
     }
     catch (Exception ex)
     {
         MessageBox.Show("There was an unexpected problem while running FlashDevelop: " + ex.Message, "Error");
     }
     finally
     {
         SingleInstanceApp.Close();
     }
 }
Exemple #28
0
        public static void LogTo(Level level, Boolean fireEvent, String rawMessage)
        {
            String message = Regex.Replace(rawMessage, "cardno=[^&]*", "****************");

            switch (level)
            {
                case Level.INFO:
                     NLogger.Info(message);
                    break;
                case Level.TRACE:
                    NLogger.Trace(message);
                    break;
                case Level.DEBUG:
                     NLogger.Debug(message);
                    break;
                case Level.WARNING:
                     NLogger.Warn(message);
                    break;
                case Level.ERROR:
                    NLogger.Error(message);
                    break;
                case Level.FATAL:
                    NLogger.Fatal(message);
                    break;
            }

            if (fireEvent)
            {
                InvokeLogToGui(new GuiEventArgs(level, message));
            }
        }
        /// <summary>
        /// Initializes the map with values from parameter.
        /// </summary>
        /// <param name="folderName">Deprecated</param>
        /// <param name="id"></param>
        /// <param name="title"></param>
        /// <param name="description"></param>
        /// <param name="fieldSize"></param>
        /// <param name="hitbox"></param>
        /// <param name="carStartSpeed"></param>
        /// <param name="carStartDirection"></param>
        /// <param name="published"></param>
        /// <param name="carStartPositions"></param>
        /// <param name="roundFinishedPositions"></param>
        /// <param name="forbiddenPositions"></param>
        public Map(
            String folderName, String id, String title, String description,
            int fieldSize, int hitbox, int carStartSpeed,
            String carStartDirection, Boolean published, BindingList<Node> carStartPositions,
            BindingList<Node> roundFinishedPositions, BindingList<Node> forbiddenPositions,
            Image image
            )
        {
            this.FolderName = folderName;

            this.Id = id;
            this.Title = title;
            this.Description = description;

            this.FieldSize = fieldSize;
            this.Hitbox = hitbox;
            this.CarStartSpeed = carStartSpeed;
            this.CarStartDirection = carStartDirection;
            this.Published = published;

            this.CarStartPositions = carStartPositions;
            this.RoundFinishedPositions = roundFinishedPositions;
            this.ForbiddenPositions = forbiddenPositions;

            this.Image = image;
        }
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int endPosition)
        {
            if (dbg) Console.Out.WriteLine("|---| " + ChunkHeader.W3D_CHUNK_TEXTURE);

            HeaderID = (int)ChunkHeader.W3D_CHUNK_TEXTURE;
            HeaderName = ChunkHeader.W3D_CHUNK_TEXTURE.ToString();
        }
 public void onFanToggled(System.Boolean toggled)
 {
     enableAnimator(fanAnimator, toggled);
 }
Exemple #32
0
    public void OnControllerGripPress(SteamVR_Behaviour_Boolean fromBehaviour, SteamVR_Input_Sources fromSource, System.Boolean state)
    {
        Debug.Log("OnControllerGripPress");
        if (fromSource == SteamVR_Input_Sources.LeftHand)
        {
            this.leftGripRelease = state;
        }
        if (fromSource == SteamVR_Input_Sources.RightHand)
        {
            this.rightGripRelease = state;
        }
        //Debug.Log(fromSource);
        //Debug.Log(state);

        if (this.leftGripRelease && this.rightGripRelease && !initialized)
        {
            this.Initialize();
        }
    }
Exemple #33
0
 public void resetScript(System.Boolean refund)
 {
     MainLoop.callAppropriateSystemMethod("UISystem", "resetScript", refund);
 }
Exemple #34
0
 public void setPause(System.Boolean newState)
 {
     MainLoop.callAppropriateSystemMethod("ZoomSystem", "setPause", newState);
 }
Exemple #35
0
 public void OnApplicationFocus(System.Boolean a)
 {
     RunFunctions(a);
 }
Exemple #36
0
 /// <summary>
 /// OnApplicationPause
 /// </summary>
 public void OnApplicationPause(System.Boolean _pause)
 {
     OnRunApplicationPause(_pause);
 }
 public void ToggleTextAnimation(System.Boolean newState)
 {
     MainLoop.callAppropriateSystemMethod("SettingsManager", "ToggleTextAnimation", newState);
 }
Exemple #38
0
 public void OnBedsChange(System.Boolean newState)
 {
     MainLoop.callAppropriateSystemMethod(system, "OnBedsChange", newState);
 }
Exemple #39
0
 public void OnSecondarySchoolChange(System.Boolean newState)
 {
     MainLoop.callAppropriateSystemMethod(system, "OnSecondarySchoolChange", newState);
 }
Exemple #40
0
 private void ReserShockWave()
 {
     canUseShockWave = true;
     Debug.Log("Can use shock wave " + currentHitPoints);
 }
Exemple #41
0
 public void OnHomeworkingChange(System.Boolean newState)
 {
     MainLoop.callAppropriateSystemMethod(null, "OnHomeworkingChange", newState);
 }
Exemple #42
0
 protected void SetParent(System.Boolean arg0)
 {
 }
Exemple #43
0
 void  Stop()
 {
     stop = true;
 }
 public void OnApplicationPause(System.Boolean a)
 {
     RunFunctions(a);
 }
 public void onPodiumToggled(System.Boolean toggled)
 {
     enableAnimator(podiumAnimator, toggled);
 }
Exemple #46
0
    // Update is called once per frame
    void Update()
    {
        //print(GamePlayState);
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (ProgramMode == Program_Mode.MENU)
            {
                ProgramMode = Program_Mode.GAME;
            }
            else if (ProgramMode == Program_Mode.GAME)
            {
                ProgramMode = Program_Mode.MENU;
            }
        }

        if (Input.GetKeyDown(KeyCode.Return))
        {
            if (ProgramMode == Program_Mode.START_SCREEN)
            {
                ProgramMode = Program_Mode.GAME;
                ELEKTRICITY.Play();
            }

            StartCoroutine(DoorOpenEffect());
        }


        if (Input.GetKeyDown(KeyCode.Escape) && ProgramMode == Program_Mode.START_SCREEN)
        {
            Application.Quit(0);
        }


        if (ProgramMode == Program_Mode.START_SCREEN)
        {
            for (u32 Index = 0;
                 Index < StartScreenItems.Length;
                 ++Index)
            {
                StartScreenItems[Index].SetActive(true);
            }
            ThePlayer.SetActive(false);
        }
        else
        {
            for (u32 Index = 0;
                 Index < StartScreenItems.Length;
                 ++Index)
            {
                StartScreenItems[Index].SetActive(false);
            }
            ThePlayer.SetActive(true);
        }

        v3 PlayerPosition = ThePlayer.transform.position; // TODO(@rudra): Every frame?

        if (Rectangle.IsInRectangle(CSG_Room1.GetRect(), PlayerPosition))
        {
            CurrentPlayerRoom = PLAYER_CURRENT_ROOM.ROOM_1;
        }

        if (Rectangle.IsInRectangle(CSG_Room2.GetRect(), PlayerPosition))
        {
            CurrentPlayerRoom = PLAYER_CURRENT_ROOM.ROOM_2;
        }

        if (Rectangle.IsInRectangle(CSG_Room3.GetRect(), PlayerPosition))
        {
            CurrentPlayerRoom = PLAYER_CURRENT_ROOM.ROOM_3;

            if (GamePlayState == GAMEPLAY_STATE.RIGHT_DOOR_OPENED)
            {
                GamePlayState            = GAMEPLAY_STATE.START_CRAZINESS;
                Human.transform.rotation = Quaternion.Euler(0.0f, 25.0f, 0.0f);
                Camera.IncreaseVHSVerticalOffset(0.04f);

                VCR_Target_Volume = 9.0f;
                T = 0.0f;
#if IGNORED
                f32 CurrentPlayTime = GM_AudioSource.time;

                GM_AudioSource.clip = VCR_Mid;
                GM_AudioSource.loop = true;
                GM_AudioSource.Play();
                GM_AudioSource.time = CurrentPlayTime;
#endif
            }
        }


        if (CurrentPlayerRoom == PLAYER_CURRENT_ROOM.ROOM_2 && DoorState == DOOR_STATE.DOOR_OPEN && GamePlayState == GAMEPLAY_STATE.INIT)
        {
            CloseDoor();

            StartCoroutine(ActivateCoffins());
            //StartCoroutine(OpenDoorWhenCollected());
        }


        if (CurrentPlayerRoom == PLAYER_CURRENT_ROOM.ROOM_2 && DoorState == DOOR_STATE.DOOR_OPEN && GamePlayState == GAMEPLAY_STATE.READ_FOURTH_NOTE)
        {
            CloseDoor();
            GamePlayState = GAMEPLAY_STATE.LEVER_SEQUENCE;
            StartCoroutine(WaitAndStartCoffinsAndInitLever());
        }

        if (CurrentPlayerRoom == PLAYER_CURRENT_ROOM.ROOM_1 && DoorState == DOOR_STATE.DOOR_OPEN && GamePlayState == GAMEPLAY_STATE.FIRST_COLLECTED)
        {
            CloseDoor();
            GamePlayState = GAMEPLAY_STATE.WAITING_FOR_NOTES;

            Letter_1.GetComponent <Animation>().Play("SendLetter");
            Human.SetActive(true);
        }

        if (Camera.HitWithRaycast(LetterLayer) && ThePlayer.GetComponent <Player>().CollidedWithLetter)
        {
            Animation LetterAnimation = Camera.LookingAt.transform.parent.gameObject.GetComponent <Animation>();
            if (LetterAnimation.isPlaying)
            {
            }
            else
            {
                if (ReadingState == READING_STATE.NONE)
                {
                    ReadingState = READING_STATE.CAN_READ;
                }
            }
        }
        else
        {
            ReadingState = READING_STATE.NONE;
        }

        EKeyProcessed = false;

        if (ReadingState == READING_STATE.READING && Input.GetKeyDown(KeyCode.E))
        {
            EKeyProcessed = true;
            ReadingState  = READING_STATE.CAN_READ;

            Letter _L = Camera.LookingAt.GetComponent <Letter>();
            if (_L.LetterTag == Letter.Tag.FIRST)
            {
                if (GamePlayState == GAMEPLAY_STATE.WAITING_FOR_NOTES)
                {
                    GamePlayState = GAMEPLAY_STATE.READ_FIRST_NOTE;
                    Letter_1.transform.position = Letter_1_Table_Position.position;

                    GamePlayState = GAMEPLAY_STATE.SECOND_NOTE_SENT;
                    Letter_2.GetComponent <Animation>().Play("SendLetter");
                }
            }
            else if (_L.LetterTag == Letter.Tag.SECOND)
            {
                if (GamePlayState == GAMEPLAY_STATE.SECOND_NOTE_SENT)
                {
                    GamePlayState = GAMEPLAY_STATE.READ_SECOND_NOTE;
                    Letter_2.transform.position = Letter_2_Table_Position.position;

                    GamePlayState = GAMEPLAY_STATE.THIRD_NOTE_SENT;
                    Letter_3.GetComponent <Animation>().Play("SendLetter");
                }
            }
            else if (_L.LetterTag == Letter.Tag.THIRD)
            {
                if (GamePlayState == GAMEPLAY_STATE.THIRD_NOTE_SENT)
                {
                    GamePlayState = GAMEPLAY_STATE.READ_THIRD_NOTE;
                    Letter_3.transform.position = Letter_3_Table_Position.position;

                    GamePlayState = GAMEPLAY_STATE.FOURTH_NOTE_SENT;
                    Letter_4.GetComponent <Animation>().Play("SendLetter");
                }
            }
            else if (_L.LetterTag == Letter.Tag.FOURTH)
            {
                if (GamePlayState == GAMEPLAY_STATE.FOURTH_NOTE_SENT)
                {
                    GamePlayState = GAMEPLAY_STATE.READ_FOURTH_NOTE;
                    Letter_4.transform.position = Letter_4_Table_Position.position;

                    StartCoroutine(OpenDoorAndEnableLever());
                }
            }
            else
            {
                // NOTE(@rudra): Case for notes on the other side
                OtherNotesProgressHash = OtherNotesProgressHash | 1 << (i32)_L.LetterTag;
                if (OtherNotesProgressHash == GameCompleteHash)
                {
                    StartCoroutine(FinishingSequence());
                }
            }
        }


        if (ReadingState == READING_STATE.CAN_READ && Input.GetKeyDown(KeyCode.E) && !EKeyProcessed)
        {
            EKeyProcessed = true;
            ReadingState  = READING_STATE.READING;
        }

        ReadingBackground.SetActive(ReadingState == READING_STATE.READING);


        // NOTE(@rudra): Lever
        if (Camera.HitWithRaycast(LeverLayer) && ThePlayer.GetComponent <Player>().CollidedWithLever)
        {
            if (LeverState != LEVER_STATE.LEVER_ON)
            {
                LeverState = LEVER_STATE.LEVER_CAN_ACCESS;
            }
        }
        else
        {
            if (LeverState != LEVER_STATE.LEVER_ON)
            {
                LeverState = LEVER_STATE.LEVER_CANNOT_ACCESS;
            }
        }


        // NOTE(@rudra): Interact text
        if (ReadingState == READING_STATE.CAN_READ || LeverState == LEVER_STATE.LEVER_CAN_ACCESS)
        {
            InteractText.text = "E";
        }
        else
        {
            InteractText.text = "";
        }

        LetterText.text = "";
        if (ReadingState == READING_STATE.READING)
        {
            Letter _L = Camera.LookingAt.GetComponent <Letter>();
            if (_L != null)
            {
                LetterText.text = _L.Contents;
            }
        }

        // NOTE(@rudra): Handle Lever
        if (LeverState == LEVER_STATE.LEVER_CAN_ACCESS && Input.GetKeyDown(KeyCode.E))
        {
            LeverState = LEVER_STATE.LEVER_ON;
            Lever.GetComponent <Animation>().Play("LeverOn");

            StartCoroutine(LightOffSequence());
        }

        // NOTE(@rudra): Right door opening sequence
        if (GamePlayState == GAMEPLAY_STATE.LEVER_ACTIVATED)
        {
            f32 SqDistanceFromPlayer = DistanceSq(RightDoor.transform.position, ThePlayer.transform.position);

            if (SqDistanceFromPlayer <= 30.0f)
            {
                GamePlayState = GAMEPLAY_STATE.RIGHT_DOOR_OPENED;
                RightDoorPivot.GetComponent <Animation>().Play("RightDoorOpen");

                AudioSource RightDoorAudio = RightDoor.GetComponent <AudioSource>();
                RightDoorAudio.clip = RightDoorOpen;
                RightDoorAudio.Play();
            }
        }

        // NOTE(@rudra): Ending sequence
        if (CurrentPlayerRoom == PLAYER_CURRENT_ROOM.ROOM_3)
        {
        }

        GameMixer.GetFloat("GM_Volume", out VCR_Current_Volume);
        VCR_Current_Volume = Mathf.Lerp(VCR_Current_Volume, VCR_Target_Volume, T);
        GameMixer.SetFloat("GM_Volume", VCR_Current_Volume);
        T += 1.0f * Time.deltaTime;

        // NOTE(@rudra): Coffin sequence
        if (FirstCoffinActivated)
        {
            f32 SqDistanceFromPlayer = DistanceSq(FirstCoffinLight.transform.position, ThePlayer.transform.position);
            if (SqDistanceFromPlayer <= CoffinMinDistance)
            {
                StartCoroutine(WaitAndActivateSecondCoffin());
            }
        }
        if (SecondCoffinActivated)
        {
            f32 SqDistanceFromPlayer = DistanceSq(SecondCoffinLight.transform.position, ThePlayer.transform.position);
            if (SqDistanceFromPlayer <= CoffinMinDistance)
            {
                StartCoroutine(WaitAndActivateThirdCoffin());
            }
        }
        if (ThirdCoffinActivated && !StartedAlready)
        {
            f32 SqDistanceFromPlayer = DistanceSq(ThirdCoffinLight.transform.position, ThePlayer.transform.position);
            if (SqDistanceFromPlayer <= CoffinMinDistance)
            {
                StartCoroutine(WaitAndActivateOpenDoor());
            }
        }
    }
Exemple #47
0
 /// <summary>
 /// OnOnApplicationFocus
 /// </summary>
 protected virtual void OnRunApplicationFocus(System.Boolean _focus)
 {
 }
Exemple #48
0
 void FixedUpdate()
 {
     controller.Move(horizontalMove * Time.fixedDeltaTime, false, jump);
     jump = false;
 }
Exemple #49
0
        /// <summary>拆分字符串成为不区分大小写的可空名值字典。逗号分组,等号分隔</summary>
        /// <param name="value">字符串</param>
        /// <param name="nameValueSeparator">名值分隔符,默认等于号</param>
        /// <param name="separator">分组分隔符,默认分号</param>
        /// <param name="trimQuotation">去掉括号</param>
        /// <returns></returns>
        public static IDictionary<String, String> SplitAsDictionary(this String value, String nameValueSeparator = "=", String separator = ";", Boolean trimQuotation = false)
        {
            var dic = new NullableDictionary<String, String>(StringComparer.OrdinalIgnoreCase);
            if (value.IsNullOrWhiteSpace()) return dic;

            if (nameValueSeparator.IsNullOrEmpty()) nameValueSeparator = "=";
            //if (separator == null || separator.Length < 1) separator = new String[] { ",", ";" };

            var ss = value.Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries);
            if (ss == null || ss.Length < 1) return null;

            foreach (var item in ss)
            {
                var p = item.IndexOf(nameValueSeparator);
                if (p <= 0) continue;

                var key = item.Substring(0, p).Trim();
                var val = item.Substring(p + nameValueSeparator.Length).Trim();

                // 处理单引号双引号
                if (trimQuotation)
                {
                    if (val[0] == '\'' && val[val.Length - 1] == '\'') val = val.Trim('\'');
                    if (val[0] == '"' && val[val.Length - 1] == '"') val = val.Trim('"');
                }

                dic[key] = val;
            }

            return dic;
        }
Exemple #50
0
 public void SetCondition(System.Boolean condition)
 {
     m_isPlayerCaught = condition;
 }
Exemple #51
0
 /// <summary>
 /// OnApplicationFocus
 /// </summary>
 public void OnApplicationFocus(System.Boolean _focus)
 {
     OnRunApplicationFocus(_focus);
 }
Exemple #52
0
 public void setActiveNextButton(System.Boolean active)
 {
     MainLoop.callAppropriateSystemMethod("UISystem", "setActiveNextButton", active);
 }
Exemple #53
0
 public void IsSuspicious(System.Boolean condition)
 {
     m_isSuspicious = condition;
 }
Exemple #54
0
 public void IsTargetInsight(System.Boolean condition)
 {
     m_isTargetInSight = condition;
 }
 public void detectCollision(System.Boolean on)
 {
     MainLoop.callAppropriateSystemMethod("DetectorGeneratorSystem", "detectCollision", on);
 }
Exemple #56
0
 /// <summary>
 /// OnApplicationFocus
 /// </summary>
 void OnApplicationFocus(System.Boolean _focus)
 {
     simulateMonoBehaviour.OnApplicationFocus(_focus);
 }
Exemple #57
0
 public void OnArtisanalProductionChange(System.Boolean newState)
 {
     MainLoop.callAppropriateSystemMethod(system, "OnArtisanalProductionChange", newState);
 }
Exemple #58
0
 public void OnMaskRequisitionChange(System.Boolean newState)
 {
     MainLoop.callAppropriateSystemMethod(system, "OnMaskRequisitionChange", newState);
 }
 public void SwitchFont(System.Boolean accessibleFont)
 {
     MainLoop.callAppropriateSystemMethod("SettingsManager", "SwitchFont", accessibleFont);
 }
Exemple #60
0
 /// <summary>
 /// OnOnApplicationPause
 /// </summary>
 protected virtual void OnRunApplicationPause(System.Boolean _pause)
 {
 }