protected void SetUpHUDAndScores() { if (PD.gameType == PersistData.GT.Challenge) { GameObject g = new GameObject("PuzzleHUD"); hud = g.AddComponent <PuzzleHUD>(); hud.Setup(1, PD.GetPuzzleLevel()); } else if (PD.gameType == PersistData.GT.Campaign) { GameObject g = new GameObject("CampaignHUD"); hud = g.AddComponent <CampaignHUD>(); hud.Setup(1); } else { GameObject g = new GameObject("InGameHUD"); hud = g.AddComponent <InGameHUD>(); if (player2Human || (PD.isDemo && PD.demoPlayers == 2)) { hud.Setup(2); } else if (PD.isTutorial) { hud.Setup(1, 1); tutorialAssist = hud.tutorialAssist; tutorialAssist.SetBoards(board1, board2); tutorialAssist.MoveHighlightToPosition(board1.GetScreenPosFromXY(4, 5)); } else { hud.Setup(1); } } }
private void FinishSetup(int seed) { bh = new BlockHandler(PD, PD.GetPuzzleLevel(), true, seed); float p1Xoffset = (PD.IsLeftAlignedHUD()?-1.5f:-5.5f), p2Xoffset = 3.0f; CreateBoards(p1Xoffset, p2Xoffset); cursor1 = CreatePlayerCursor(player1Human, p1Xoffset, 1, board1, board2); cursor2 = CreatePlayerCursor(false, p2Xoffset, 2, board2, board1, PD.override2P); if (PD.isOnlineHost) { board1.Setup(cursor1, th, bh, new Vector2(PD.IsLeftAlignedHUD()?-0.725f:0.75f, -0.6f), false, true, player1Human && usingTouchControls); board2.Setup(cursor2, th, bh, new Vector2(0.2f, -0.6f), true, false); } else { board2.Setup(cursor2, th, bh, new Vector2(0.2f, -0.6f), true, false); board1.Setup(cursor1, th, bh, new Vector2(PD.IsLeftAlignedHUD()?-0.725f:0.75f, -0.6f), false, true, player1Human && usingTouchControls); } board1.RefreshGraphics(); board2.RefreshGraphics(); if (PD.runningScore > 0) { board1.AddToScore(PD.runningScore); } if (PD.runningTime > 0) { hud.SetTimeWithSeconds(PD.runningTime); } CreateMirrors(p1Xoffset, p2Xoffset); mirror1.RefreshGraphics(); mirror2.RefreshGraphics(); SetupMouseControls(p1Xoffset); }
public void Start() { StateControllerInit(false); usingTouchControls = PD.GetSaveData().savedOptions["touchcontrols"] == 1; firstLaunch = true; player1Human = !PD.isDemo; player2Human = (PD.gameType == PersistData.GT.Versus); bh = new BlockHandler(PD, PD.GetPuzzleLevel()); zaps = new List <ZappyGun>(); zapsToDelete = new List <ZappyGun>(); SetupCountdown(); SetupActors(); SetupRoundDisplay(); SetupEasterEgg(); specialMode = PD.useSpecial; height = PD.isTutorial?6:PD.rowCount; width = 8; float p1Xoffset = (player2Human || (PD.isDemo && PD.demoPlayers == 2)) ? -10.1f : (PD.IsLeftAlignedHUD()?-1.5f:-5.5f), p2Xoffset = 3.0f; CreateBoards(p1Xoffset, p2Xoffset); SetUpHUDAndScores(); if (PD.gameType == PersistData.GT.Challenge) { (board1 as BoardWarPuzzlePlayer).unlockedRow = (hud as PuzzleHUD).GetUnlockedRow(); } cursor1 = CreatePlayerCursor(player1Human, p1Xoffset, 1, board1, board2); cursor2 = CreatePlayerCursor(player2Human || PD.override2P, p2Xoffset, 2, board2, board1, PD.override2P); board1.Setup(cursor1, th, bh, (player2Human || (PD.isDemo && PD.demoPlayers == 2)) ? new Vector2(-0.2f, -0.6f) : new Vector2(PD.IsLeftAlignedHUD()?-0.725f:0.75f, -0.6f), player2Human || (PD.isDemo && PD.demoPlayers == 2), true, player1Human && usingTouchControls); board2.Setup(cursor2, th, bh, new Vector2(0.2f, -0.6f), true, player2Human || (PD.isDemo && PD.demoPlayers == 2)); board1.RefreshGraphics(); board2.RefreshGraphics(); CreateMirrors(p1Xoffset, p2Xoffset); mirror1.RefreshGraphics(); mirror2.RefreshGraphics(); SetupMouseControls(p1Xoffset); if (!PD.isDemo) { if (PD.gameType == PersistData.GT.Campaign) { campaign = new CampaignHandler(PD, board1 as BoardWarSpecial, board2 as BoardWarCampaign, mirror2 as BoardMirrorSpecial, cursor1 as BoardCursorWar, cursor2 as BoardCursorBot, hud as CampaignHUD, GetXMLHead()); } pauseButtonSheet = Resources.LoadAll <Sprite>(SpritePaths.ShortButtons); pauseButton = GetGameObject(player2Human ? (new Vector3(0.0f, -0.1f)):(new Vector3(2.5f, 0.7f)), "Pause Button", pauseButtonSheet[0], true, "HUD"); pauseButton.SetActive(PD.usingMouse); pauseButton.transform.localScale = new Vector3(0.75f, 0.75f); FontData f = PD.mostCommonFont.Clone(); f.scale = 0.035f; pauseText = GetMeshText(player2Human ? (new Vector3(0.0f, 0.0f)):(new Vector3(2.5f, 0.8f)), GetXmlValue(GetXMLHead(), "pause"), f).gameObject; pauseText.SetActive(PD.usingMouse); pauseTimer = 0; mouseObjects.Add(pauseButton); mouseObjects.Add(pauseText); } else { demoCountdown = 1800; } }
public void Start() { StateControllerInit(false); playeractor = CreateActor(PD.GetPlayerSpritePath(PD.p1Char), new Vector3(-5.15f, 1.0f)); PD.GetNextOpponent(); opponentactor = CreateActor(PD.GetPlayerSpritePath(PD.p2Char), new Vector3(5.15f, 1.0f), true); skipMenuIsUp = false; XmlNodeList dialogs = GetXMLHead("/" + playeractor.GetPath(PD.p1Char == PersistData.C.FuckingBalloon), "dialogs").SelectNodes("dialog"); XmlNode dialog = dialogs[PD.GetPuzzleLevel()]; dialogArr = dialog.SelectNodes("line"); rawInput = GetInputHandler(); dialogueBox = gameObject.AddComponent <DialogContainer>(); dialogueBox.Setup(new Vector3(0.0f, -3.5f)); bool isBossChar = PD.p1Char == PersistData.C.White || PD.p1Char == PersistData.C.September; curFrame = (!isBossChar && (PD.level == 6 || PD.level == 8))?0:2; StartFrame(curFrame); skipButtonSheet = Resources.LoadAll <Sprite>(SpritePaths.ShortButtons); skipButton = GetGameObject(new Vector3(8.3f, -4.75f), "Skip", skipButtonSheet[0], true, "Pause HUD Buttons"); FontData font = PD.mostCommonFont.Clone(); font.scale = 0.045f; XmlNode top = GetXMLHead(); skipText = GetMeshText(new Vector3(8.3f, -4.61f), GetXmlValue(top, "skip"), font).gameObject; skipText.renderer.sortingLayerName = "Pause HUD Text"; mouseObjects.Add(skipButton); mouseObjects.Add(skipText); skipMenu = GetGameObject(new Vector3(0.0f, 0.0f), "Skip Menu", Resources.Load <Sprite>(SpritePaths.CutsceneSkipBox), false, "HUDText"); string f = string.Format(GetXmlValue(top, "skipmessage"), "\r\n", PD.controller.GetFriendlyActionName(InputMethod.Action.launch), PD.controller.GetFriendlyActionName(InputMethod.Action.pause)); font.scale = 0.08f; font.layerName = "Reference"; skipMenuText = GetMeshText(new Vector3(0.0f, 0.5f), f, font); skipMenuText.text = new WritingWriter().GetWrappedString(skipMenuText, f, skipMenu.renderer.bounds.size); skipMenuText.gameObject.SetActive(false); skipMenu.SetActive(false); PD.sounds.SetSoundVolume(PD.GetSaveData().savedOptions["vol_s"] / 350.0f); }
private void setText() { if (PD.p2Char == PersistData.C.FuckingBalloon) { SetPuhloon(); return; } XmlDocument doc = new XmlDocument(); TextAsset ta = Resources.Load <TextAsset>("XML/" + PD.culture + "/" + playeractor.GetPath(PD.p1Char == PersistData.C.FuckingBalloon)); doc.LoadXml(ta.text); XmlNode An = doc.SelectSingleNode("dialogs"); XmlNodeList nl = An.SelectNodes("dialog"); XmlNode dialog = nl[PD.GetPuzzleLevel()]; XmlNodeList allLines = dialog.SelectNodes("line"); XmlNode textNode = allLines[didP1Win?1:0]; string textToSay = textNode.InnerText; if (textNode.Attributes["speaker"].Value == "1" && PD.p1Char == PersistData.C.FuckingBalloon) { textToSay = "p" + new string('f', Random.Range(4, 10)) + "th" + new string('e', Random.Range(4, 10)) + "nk"; } tbox.StartTextFrame(textToSay); if (textNode.Attributes["speed"] == null) { tbox.UpdateFrameRate(1.0f); } else { tbox.UpdateFrameRate(float.Parse(textNode.Attributes["speed"].Value)); } if (textNode.Attributes["speaker"].Value == "1") { setActor(playeractor, textNode.Attributes["pose"].Value); hideActor(opponentactor); isP1Speaker = true; } else { setActor(opponentactor, textNode.Attributes["pose"].Value); hideActor(playeractor); isP1Speaker = false; } }
public void Start() { StateControllerInit(); PD.sounds.SetVoiceAndPlay(SoundPaths.NarratorPath + "021", 0); menu = GetGameObject(new Vector3(-1.75f, 0.0f), "Puzzle Select Menu", Resources.Load <Sprite>(SpritePaths.PuzzleListBox), true); info = GetGameObject(new Vector3(1.75f, 0.0f), "Puzzle Select Info", Resources.Load <Sprite>(SpritePaths.PuzzleInfoBox)); navinfo = GetXMLHead(); FontData f = PD.mostCommonFont.Clone(); infotext = GetMeshText(info.transform.position + new Vector3(0.0f, -0.32f), "", f); levelData = GetXMLHead("/challenges", "challenges", false).SelectNodes("challenge"); levelCount = levelData.Count - 1; // first entry is tutorial int actlevel = PD.GetPuzzleLevel(); if (actlevel == 0) { actlevel = GetFirstIncompletePuzzle(); } else { actlevel++; } int y = Mathf.FloorToInt((actlevel - 1) / 4), x = actlevel - y * 4 - 1; y = 7 - y; cursor = GetMenuCursor(4, 8, SpritePaths.PuzzleCursor, -2.65f, -1.0f, 0.6f, 0.3f, x, y); cursor.loopAround = true; PD.rounds = 0; PD.totalRoundTime = 0; PD.useSpecial = false; previewer = GetPreviewer(); AddVictoryIcons(); }