private static void FinishLevelPoints(LevelType level) { string levelNumberStr = level.ToString(); int levelValue = int.Parse(levelNumberStr.TrimStart('_')); Player1Points += (100 * levelValue); }
public void Save(XElement parentElement) { var newElement = new XElement("Level", new XAttribute("seed", Seed), new XAttribute("biome", Biome.Identifier), new XAttribute("type", Type.ToString()), new XAttribute("difficulty", Difficulty.ToString("G", CultureInfo.InvariantCulture)), new XAttribute("size", XMLExtensions.PointToString(Size)), new XAttribute("generationparams", GenerationParams.Identifier), new XAttribute("initialdepth", InitialDepth)); if (HasBeaconStation) { newElement.Add( new XAttribute("hasbeaconstation", HasBeaconStation.ToString()), new XAttribute("isbeaconactive", IsBeaconActive.ToString())); } if (Type == LevelType.Outpost) { if (EventHistory.Any()) { newElement.Add(new XAttribute("eventhistory", string.Join(',', EventHistory.Select(p => p.Identifier)))); } if (NonRepeatableEvents.Any()) { newElement.Add(new XAttribute("nonrepeatableevents", string.Join(',', NonRepeatableEvents.Select(p => p.Identifier)))); } } parentElement.Add(newElement); }
public async Task InterestSelectedAsync(IDialogContext context, IAwaitable <DomainType> argument) { DomainType selectedInterest = await argument; if (interests.Contains(selectedInterest)) { // valid level selected domain = selectedInterest; // get input from user Query query = new Query(age, level.ToString(), domain.ToString(), mediumType); FileProvider provider = new FileProvider(); // get results accourding to the input List <Result> results = provider.GetResults(query); IMessageActivity reply; if (results.Any()) { reply = this.GetReply(context, results.First()); } else { reply = this.GetCannedReply(context); } await context.PostAsync(reply); } else { await context.PostAsync("Please start over."); } context.Wait(this.MessageReceived); }
/// <summary> /// Send level up packet to client and update database /// </summary> /// <param name="client">The MapClient</param> /// <param name="type">The LevelType that gained level(s)</param> /// <param name="numLevels">The number of levels gained</param> private void SendLevelUp(MapClient client, LevelType type, uint numLevels) { //Update DB Packets.Server.LevelUp sendPacket = new SagaMap.Packets.Server.LevelUp(); sendPacket.SetLevelType((byte)type); sendPacket.SetActorID(client.Char.id); sendPacket.SetLevels(1); client.netIO.SendPacket(sendPacket, client.SessionID); switch (type) { case LevelType.CLEVEL: SagaMap.Skills.SkillHandler.CalcHPSP(ref client.Char); client.Char.HP = client.Char.maxHP; client.Char.SP = client.Char.maxSP; client.Char.cLevel += numLevels; client.Char.stpoints += (byte)(2 * numLevels); // TODO implement getting this from level configuration client.SendBattleStatus(); client.SendCharStatus(0); client.SendExtStats(); break; case LevelType.JLEVEL: client.Char.jLevel += numLevels; client.Char.HP = client.Char.maxHP; client.Char.SP = client.Char.maxSP; client.SendCharStatus(0); break; } Logger.ShowInfo(client.Char.name + " gained " + numLevels + "x" + type.ToString(), null); //if (client.Party != null) // client.Party.UpdateMemberInfo(client); }
private static void SkillCommand(ISocketMessageChannel channel, LevelType levelType) { if (!HypixelSkybot.TryGet(channel, out var skybot)) { channel.SendMessageAsync("Im not watching a profile in this channel yet, use !watch first"); } else { var sb = new StringBuilder(); foreach (var profile in skybot) { var level = profile[levelType]; sb.Append(profile.Username); sb.Append(" is "); sb.Append(levelType.ToString().ToLower()); sb.Append(" level "); sb.Append(level.CurrentLevel.ToString()); sb.Append(" with "); sb.Append(level.Xp); sb.Append("/"); sb.Append(level.XpForLevelup); sb.AppendLine("xp."); } channel.SendMessageAsync(sb.ToString()); } }
private void ParseLogger(XmlElement e) { XmlElement details = e["details"]; string level = null; string name = null; if (details != null && details.HasAttributes) { level = details.Attributes["level"].Value; name = details.Attributes["name"].Value; } Logger log = this.v_rank.GetLogger(name) as Logger; log.Parent = this.v_rank.Root; lock (log) { if (string.IsNullOrEmpty(level) || level.ToLower() != "null") { LevelType lev = (LevelType)Enum.Parse(typeof(LevelType), level); log.Level = new Level(lev, lev.ToString()); } log.RemoveAllNotifiers(); } ParseLogger(ref log, e, false); loggers.Add(log); }
//---------------------------------------------------------------------- // Pick() -- this takes an encounter description and creates a real // instance. The primary purpose is to take the min/max // ranges of the elements and convert them into a specific // count -- nothing fancy. ) //---------------------------------------------------------------------- public RandomEncounter Pick( ) { RandomEncounter actualEncounter = new RandomEncounter( m_XmlNode, m_Facet, m_RegionType, m_RegionName, m_Inclusive ? "*" : m_Probability.ToString(), m_Shortest.ToString(), m_Farthest.ToString(), m_LandType.ToString(), m_EncounterTime.ToString(), m_Level.ToString(), m_LevelType.ToString(), m_ScaleUp.ToString() ); actualEncounter.m_Distance = Utility.RandomMinMax(m_Shortest, m_Farthest); foreach (EncounterElement element in m_Elements) { ArrayList pickedElements = element.Pick(); foreach (EncounterElement pickedElement in pickedElements) { actualEncounter.m_Elements.Add(pickedElement); } } return(actualEncounter); }
// Update is called once per frame void Update() { if (x3 == null) { x3 = new Xbox360Controller(ID); } if (SignedIn) { float hor = x3.HorizontalAxis(); float ver = x3.VerticalAxis(); this.transform.position += new Vector3(hor, -ver) * speed; } else { if (x3.StartPressed()) { SignedIn = true; this.GetComponent <SpriteRenderer> ().enabled = true; select.transform.GetChild(1).GetComponent <Text> ().text = ""; select.color = desired; SignedInCount++; AudioSource.PlayClipAtPoint(GameObject.FindObjectOfType <NetworkingObjectMenu>().click, GameObject.FindGameObjectWithTag("MainCamera").transform.position); } } if (collidingLevel != null) { if (x3.PressedJump()) { LevelType level = collidingLevel.lt; GlobalProperties.LEVEL = level.ToString(); collidingLevel.GetComponent <SpriteRenderer>().color = Color.red; AudioSource.PlayClipAtPoint(collidingLevel.noise, GameObject.FindGameObjectWithTag("MainCamera").transform.position); if (prevCollidingLevel == null || prevCollidingLevel == collidingLevel) { prevCollidingLevel = collidingLevel; } else { prevCollidingLevel.GetComponent <SpriteRenderer>().color = Color.white; prevCollidingLevel = collidingLevel; } } } else if (colliding != null) { if (x3.PressedJump()) { CharacterType character = colliding.ct; GlobalProperties.PLAYERCHOICE[ID - 1] = character.ToString(); select.transform.GetChild(2).GetComponent <Image>().sprite = GameObject.FindObjectOfType <CharacterDictionary>().GetByText(character.ToString()); select.transform.GetChild(1).GetComponent <Text> ().text = "\n" + character.ToString(); select.transform.GetChild(1).GetComponent <Text> ().alignment = TextAnchor.UpperRight; AudioSource.PlayClipAtPoint(colliding.noise, GameObject.FindGameObjectWithTag("MainCamera").transform.position); } } }
private static void ShowLevel(LevelType level) { ConsoleUtil.Write(scoreOffset, 4, "00000000000000000000", ConsoleColor.Gray, ConsoleColor.Gray); string leveltostring = level.ToString(); leveltostring = leveltostring.Trim('_'); ConsoleUtil.Write(scoreOffset + 1, 4, leveltostring, ConsoleColor.Black, ConsoleColor.Gray); }
public override string ToString() { if (Type == LevelType.None) { return(string.Empty); } return((Type == LevelType.Standard ? "Normal" : Type.ToString()) + " #" + Index); }
public override string ToString() { return(string.Format("type={0} len={1} word1={2} pos1={3} stemmed1={4} priorpolarity={5}", type.ToString(), len.ToString(), word1, pos1.ToString(), stemmed1 ? "y" : "n", priorpolarity)); }
public static Logging.CBLoggers Build(string sid, LevelType level, string logger, string message) { Logging.CBLoggers logMessage = new Logging.CBLoggers(); logMessage.memberID = sid; logMessage.Level = level.ToString(); logMessage.Logger = logger; logMessage.Message = message; return(logMessage); }
public bool Search(string str) { if (Skill.Value.ToString().Contains(str) || SkillType.ToString().Contains(str) || Level.ToString().Contains(str) || LevelType.ToString().Contains(str)) { return(true); } else { return(false); } }
public void EndLevel() { LevelScript ls = FindObjectOfType <LevelScript>(); if (ls != null) { Destroy(ls.gameObject); } m_winPanel.SetActive(true); m_otherAudioSource.Play(); SaveManager.Instance.LevelCompleted(m_currentLevelType.ToString()); }
public static LevelInfoHolder ReadLevel(string fileName, LevelType type) { var lines = File.ReadLines(fileName); var iter = lines.GetEnumerator(); string toFind = type.ToString(); int idToFind = 0; switch (type) { case LevelType.Classic: idToFind = VALUES.random.Next(1, VALUES.MAX_CLASSIC_LVL_ID); break; case LevelType.Event: idToFind = VALUES.random.Next(1, VALUES.MAX_EVENT_LVL_ID); break; } LevelInfoHolder lvl = new LevelInfoHolder { id = idToFind, data = new List <string>() }; var begin = lines .SkipWhile(line => !(line.Contains("===") && line.Contains(idToFind.ToString()) && line.Contains(type.ToString()))) .ToList(); lvl.type = ParseLevelType(begin.First().Split(' ').Last()); lvl.data = begin .Skip(1) .TakeWhile(line => !line.Contains("===")) .ToList(); return(lvl); }
protected virtual void LogToConsole(string body, LevelType level, SeverityType severity, params object[] parameters) { string text = ""; try { text = parameters.Length == 0 ? body : string.Format(body, parameters); } catch { text = body; } Console.WriteLine($"{DateTime.Now.ToString("HH:mm")} {level.ToString()} {severity.ToString()} | {text}"); }
public EditLevelDialog( int width, Point playerStartingPosition, LevelType levelType, Point exitPosition, double scrollSpeed, string song, bool stopSong, Func <EditLevelDialog, bool> validationFunc) { InitializeComponent(); // Width this.widthTextBox.Text = width.ToString(); // Starting position this.playerXTextBox.Text = playerStartingPosition.X.ToString(); this.playerYTextBox.Text = playerStartingPosition.Y.ToString(); // Level type this.levelTypeComboBox.Items.Clear(); this.levelTypeComboBox.Items.Add(LevelType.Normal.ToString()); this.levelTypeComboBox.Items.Add(LevelType.Jetpack.ToString()); this.levelTypeComboBox.Items.Add(LevelType.Boss.ToString()); this.levelTypeComboBox.SelectedItem = levelType.ToString(); this.LevelTypeComboBoxSelectedIndexChanged(null, null); // Exit position this.exitXTextBox.Text = (exitPosition.X / Constants.BackgroundTileWidth).ToString(); this.exitYTextBox.Text = (exitPosition.Y / Constants.BackgroundTileHeight).ToString(); // Scroll speed this.scrollSpeedComboBox.SelectedItem = scrollSpeed.ToString(); // Song this.songComboBox.Items.Clear(); foreach (var item in SoundDataReader.GetSongs().Keys) { this.songComboBox.Items.Add(item); } this.songComboBox.SelectedItem = song; this.stopSongCheckBox.Checked = stopSong; // Store the validation function this.validationFunc = validationFunc; }
public void Save(XElement parentElement) { var newElement = new XElement("Level", new XAttribute("seed", Seed), new XAttribute("biome", Biome.Identifier), new XAttribute("type", Type.ToString()), new XAttribute("difficulty", Difficulty.ToString("G", CultureInfo.InvariantCulture)), new XAttribute("size", XMLExtensions.PointToString(Size)), new XAttribute("generationparams", GenerationParams.Identifier)); if (Type == LevelType.Outpost && EventHistory.Any()) { newElement.Add(new XAttribute("eventhistory", string.Join(',', EventHistory.Select(p => p.Identifier)))); } parentElement.Add(newElement); }
protected virtual void LogToConsole(string body, LevelType level, SeverityType severity, params object[] parameters) { string text = ""; try { text = parameters.Length == 0 ? body : string.Format(body, parameters); } catch { text = body; } text = $"{DateTime.Now.ToString("HH:mm")} {level.ToString()} {severity.ToString()} | {text}"; lock (fileLock) { File.AppendAllText(fileName, text + Environment.NewLine); } }
public override string ToString() { string strBack = ""; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { strBack += backCells[i, j] + " "; } strBack += "\n"; } string str = "width: " + width + "\n" + "height: " + height + "\n" + "type: " + type.ToString() + "\n" + "score: " + score + "\n" + "chipGen: " + chipGen + "\n" + "chipStartGen: " + chipStartGen + "\n" + strBack; return(str); }
/// <summary> /// 当载入关卡 /// </summary> static IEnumerator OnLoadLevel(LevelType levelType, LuaTable self, LuaFunction onLeave, LuaFunction onEnter) { Scene scene = SceneManager.GetActiveScene(); var levelName = scene.name.FirstCharToUpper(); LevelType currLevel = (LevelType)Enum.Parse(typeof(LevelType), levelName); var op = SceneManager.LoadSceneAsync(levelType.ToString()); yield return(op); yield return(new WaitForSeconds(0.1f)); if (LevelType.Loader == levelType) { if (onLeave != null) { onLeave.Call <LuaTable, LevelType, Action>(self, currLevel, delegate() { Util.StartCoroutine(OnLoadLevel(newLevel, self, onLeave, onEnter)); }); onLeave.Dispose(); onLeave = null; } } else { if (onEnter != null) { var loadMsg = "OnLoadLevel " + levelType + " OK!!!"; onEnter.Call <LuaTable, LevelType, Action>(self, levelType, () => GLogger.Yellow(loadMsg)); onEnter.Dispose(); onEnter = null; self.Dispose(); self = null; } } }
private void ParseRootLogger() { if (rootnode != null) { Logger root = this.v_rank.Root; XmlElement details = rootnode[DETAILS_STR]; string level = null; if (details.HasAttributes) { level = details.Attributes[LEVEL_STR].Value; } lock (root) { if (!string.IsNullOrEmpty(level) || level.ToLower() != "null") { LevelType lev = (LevelType)Enum.Parse(typeof(LevelType), level); root.Level = new Level(lev, lev.ToString()); } root.RemoveAllNotifiers(); } ParseLogger(ref root, rootnode, true); } }
public override string ToString() { return(type.ToString() + "/" + cc.ToString()); }
public BusinessLevel() { Name = currentLevel.ToString(); }
private void OnEnable() { if (Network.isServer) { levelType = (LevelType) PlayerPrefs.GetInt("serverType", (int) LevelType.sky); Debug.Log("level: " + levelType.ToString() + " " + (int) levelType); int intLevelType = (int) levelType; networkView.RPC("SetEndTime", RPCMode.AllBuffered, (float)Network.time + gameLength, (int)State.inGame, intLevelType); } bots = GameObject.FindGameObjectsWithTag("Bot"); state = State.inGame; }
public void WriteCSV(LevelType levelType, string[] contents) { string path = String.Format("{0}/{1}.{2}", OutDir, levelType.ToString(), CsvExt); File.WriteAllLines(path, contents); }
public void CleanOuSubtDir(LevelType levelType) { string path = String.Format("{0}/{1}", OutDir, levelType.ToString()); CleanOut(path); }
public string GetCSVFile(LevelType levelType) { return(String.Format("{0}/{1}.{2}", InpDir, levelType.ToString(), CsvExt)); }
/// <summary> /// Reads Data out of a Custom or Story Level /// </summary> /// <param name="level_name">The LevelName</param> /// <param name="leveltype">Custom or Story level</param> /// <returns>If it was successfull</returns> bool LoadCustomOrStoryLevel(string level_name,LevelType leveltype) { bool level_loaded = false; error_messages = new List<string>(); string daten; //StreamReader stream = new StreamReader("Data/Levels/"+leveltype.ToString()+"/" + level_name + ".map"); //daten = stream.ReadToEnd(); //stream.Close(); daten = FileManager.ReadFile("Data/Levels/" + leveltype.ToString() + "/" + level_name + ".map"); level_loaded = LoadLevel(daten); return level_loaded; }
public string[] GetFiles(LevelType levelType) { string path = String.Format("{0}/{1}", InpDir, levelType.ToString()); return(Directory.GetFiles(path)); }
public void Log(Type callerStackBoundaryDeclaringType, LevelType level, object message, Exception exception) { try { if (this.IsEnabledFor(level)) { this.Log(new LogInfo(message, callerStackBoundaryDeclaringType, new Level(level, level.ToString()), this.Name, exception, DateTime.Now, null)); } } catch (Exception ex) { //LogLog.Error("Log: Exception while logging", ex); } }
public void SaveLevelTypeSetting(LevelType levelType) { localSettings.Values["levelType"] = levelType.ToString(); }