// Use this for initialization void Start() { CreateProfile(); FileIO.LoadProfiles(); menuInputPlayerOne = new ControllerMenuInput(); menuInputPlayerTwo = new ControllerMenuInput(); menuInputPlayerThree = new ControllerMenuInput(); menuInputPlayerFour = new ControllerMenuInput(); menuInputPlayerOne.Init(texture, FileIO.profileContainer.profiles.Count - 1, iDotSize, fTimeBetweenMoves, GamepadInput.GamePad.Index.One); menuInputPlayerTwo.Init(texture, FileIO.profileContainer.profiles.Count - 1, iDotSize, fTimeBetweenMoves, GamepadInput.GamePad.Index.Two); menuInputPlayerThree.Init(texture, FileIO.profileContainer.profiles.Count - 1, iDotSize, fTimeBetweenMoves, GamepadInput.GamePad.Index.Three); menuInputPlayerFour.Init(texture, FileIO.profileContainer.profiles.Count - 1, iDotSize, fTimeBetweenMoves, GamepadInput.GamePad.Index.Four); lP1Buttons = new List <sButton>(); lP2Buttons = new List <sButton>(); lP3Buttons = new List <sButton>(); lP4Buttons = new List <sButton>(); //add buttons //need four sets of buttons int count = 0; // temp way to move buttons //upper left ( player 1 ) foreach (Profile p in FileIO.profileContainer.profiles) { sButton b = new sButton(); b.Init(p.name, new Vector2((Screen.width / 4) - standardButton.width / 2, standardButton.y + count * 30), new Vector2(standardButton.width, standardButton.height), LoadProfileP1, p.name); lP1Buttons.Add(b); count++; } count = 0; //upper right ( player 2 ) foreach (Profile p in FileIO.profileContainer.profiles) { sButton b = new sButton(); b.Init(p.name, new Vector2((Screen.width / 2 + Screen.width / 4) - standardButton.width / 2, standardButton.y + count * 30), new Vector2(standardButton.width, standardButton.height), LoadProfileP2, p.name); lP2Buttons.Add(b); count++; } //lower left ( player 3 ) count = 0; foreach (Profile p in FileIO.profileContainer.profiles) { sButton b = new sButton(); b.Init(p.name, new Vector2((Screen.width / 4) - standardButton.width / 2, standardButton.y + (Screen.height * fSecondRowDropPercent) + count * 30), new Vector2(standardButton.width, standardButton.height), LoadProfileP3, p.name); lP3Buttons.Add(b); count++; } //lower right ( player 4 ) count = 0; foreach (Profile p in FileIO.profileContainer.profiles) { sButton b = new sButton(); b.Init(p.name, new Vector2((Screen.width / 2 + Screen.width / 4) - standardButton.width / 2, standardButton.y + (Screen.height * fSecondRowDropPercent) + count * 30), new Vector2(standardButton.width, standardButton.height), LoadProfileP4, p.name); lP4Buttons.Add(b); count++; } }
public void SetActiveButton(sButton aActive) { active = aActive; Vector2 pos = active.GetPos(); //variable to hold new pos for dot, set to active buttons's pos //dots need to move due to both being drawn from upper left //both need to move negativily in the y to center on button //right dot needs to move rigth by length of button dotRight.vPosition = new Vector2(pos.x + active.GetSize().x, pos.y - 20); // dotLeft.vPosition = new Vector2(pos.x - dotLeft.vSize.x, pos.y - 20); }
// Use this for initialization void Start() { controller = new ControllerMenuInput(); controller.Init(texture, (int)(fNumOfButtons - 1), iDotSize, fTimeBetweenMoves); float fButtonCount = 0; lButtons = new List <sButton>(); fScreenWidth = Screen.width; fScreenHeight = Screen.height; fSpaceForButton.y = (fScreenHeight / 2) / fNumOfButtons; fSpaceForButton.x = fScreenWidth / 4; sButton b = new sButton(); b.Init("Play", new Vector2((fScreenWidth / 2) - (fScreenWidth / 8), (fScreenHeight / 2) + fSpaceForButton.y * fButtonCount), fSpaceForButton, b.LoadLevel, PlayLevel); lButtons.Add(b); fButtonCount++; // Button b2 = new Button(); // b2.Init("Multiplayer",new Vector2( fScreenWidth/2 - fScreenWidth/8 , fScreenHeight/2 + fSpaceForButton.y*fButtonCount) , fSpaceForButton, b2.LoadLevel , "level"); // lButtons.Add( b2 ); // fButtonCount++; sButton b3 = new sButton(); b3.Init("Profiles", new Vector2(fScreenWidth / 2 - fScreenWidth / 8, fScreenHeight / 2 + fSpaceForButton.y * fButtonCount), fSpaceForButton, b3.LoadLevel, ProfilesLevel); lButtons.Add(b3); fButtonCount++; sButton b4 = new sButton(); b4.Init("Options", new Vector2(fScreenWidth / 2 - fScreenWidth / 8, fScreenHeight / 2 + fSpaceForButton.y * fButtonCount), fSpaceForButton, b4.LoadLevel, OptionsLevel); lButtons.Add(b4); fButtonCount++; sButton b5 = new sButton(); b5.Init("Credits", new Vector2(fScreenWidth / 2 - fScreenWidth / 8, fScreenHeight / 2 + fSpaceForButton.y * fButtonCount), fSpaceForButton, b5.LoadLevel, CreditsLevel); lButtons.Add(b5); fButtonCount++; sButton b6 = new sButton(); b6.Init("Exit", new Vector2(fScreenWidth / 2 - fScreenWidth / 8, fScreenHeight / 2 + fSpaceForButton.y * fButtonCount), fSpaceForButton, b5.ExitGame, "Credits"); lButtons.Add(b6); fButtonCount++; }
public IEnumerator AnimateButtonSequence() { //Sets Simon's sequence to animating animatingSequence = true; foreach (int id in simonSequence) { //Wait 1 second before animating each button animation yield return(new WaitForSeconds(1.0f)); //Get the button that corresponds to the id in Simon's sequence sButton button = GetButtonFromID(id); //Start the button animation StartCoroutine(button.AnimateButton()); } //Sets Simon's sequence to not animating animatingSequence = false; }
void MakeProfileButtons(bool clearList) { if (clearList) { profileButtons.Clear(); } float f = 0; float a = 5; // point that these start at foreach (Profile p in FileIO.profileContainer.profiles) { sButton b = new sButton(); b.Init("Load: " + p.name, new Vector2(colWidth / 2, rowHeight * (a + f)), vSize, LoadProfile, p.name); profileButtons.Add(b); f++; } }
// Use this for initialization void Start() { started = true; FileIO.LoadProfiles(); controllerMenuInput = new ControllerMenuInput(); controllerMenuInput.Init(texture, 9, iDotSize, fTimeBetweenMoves); controllerMenuInput.bActiveButtonConstantPressed = true; //state = new ProfileSceneState(); vSize = new Vector2(colWidth, rowHeight); createProfileButton = new sButton(); createProfileButton.Init("Create Profile", new Vector2(colWidth / 2, rowHeight * 2), vSize, CreateProfileFunc, "None"); loadProfileButton = new sButton(); loadProfileButton.Init("Load Profile", new Vector2(200, 200), vSize, CreateProfileFunc, "None"); exitButton = new sButton(); exitButton.Init("Exit", new Vector2(colWidth / 2, rowHeight * 4), vSize, ExitProfileButtonFunc, "Exit"); saveButton = new sButton(); saveButton.Init("Save", new Vector2(colWidth / 2, rowHeight * 3), vSize, SaveProfileButtonFunc, "Save"); profileButtons = new List <sButton>(); MakeProfileButtons(false); //editButtons = new List<sButton>(); editNameButton = new sButton(); editNameButton.Init("Name: ", new Vector2(rNameText.x, rNameText.y), new Vector2(rNameText.width, rNameText.height), SwitchButton, "Name"); editAttackButton = new sButton(); editAttackButton.Init("Attack: ", new Vector2(rAttackDis.x, rAttackDis.y), new Vector2(rAttackDis.width, rAttackDis.height), SwitchButton, "Attack"); editJumpButton = new sButton(); editJumpButton.Init("Jump: ", new Vector2(rJumpDis.x, rJumpDis.y), new Vector2(rJumpDis.width, rJumpDis.height), SwitchButton, "Jump"); editPauseButton = new sButton(); editPauseButton.Init("Pause: ", new Vector2(rPauseDis.x, rPauseDis.y), new Vector2(rPauseDis.width, rPauseDis.height), SwitchButton, "Pause"); editSwap1Button = new sButton(); editSwap1Button.Init("Swap1: ", new Vector2(rSwap1Dis.x, rSwap1Dis.y), new Vector2(rSwap1Dis.width, rSwap1Dis.height), SwitchButton, "Swap1"); editSwap2Button = new sButton(); editSwap2Button.Init("Swap2: ", new Vector2(rSwap2Dis.x, rSwap2Dis.y), new Vector2(rSwap2Dis.width, rSwap2Dis.height), SwitchButton, "Swap2"); editSwap3Button = new sButton(); editSwap3Button.Init("Swap3: ", new Vector2(rSwap3Dis.x, rSwap3Dis.y), new Vector2(rSwap3Dis.width, rSwap3Dis.height), SwitchButton, "Swap3"); editSwap4Button = new sButton(); editSwap4Button.Init("Swap4: ", new Vector2(rSwap4Dis.x, rSwap4Dis.y), new Vector2(rSwap4Dis.width, rSwap4Dis.height), SwitchButton, "Swap4"); editDeleteButton = new sButton(); editDeleteButton.Init("Delete Profile ", new Vector2(rSwap4Dis.x, rSwap4Dis.y + rowHeight), new Vector2(rSwap4Dis.width, rSwap4Dis.height), DeleteActiveProfileButtonFunc, "Delete"); }
public void SetActiveButton( sButton aActive) { active = aActive; Vector2 pos = active.GetPos(); //variable to hold new pos for dot, set to active buttons's pos //dots need to move due to both being drawn from upper left //both need to move negativily in the y to center on button //right dot needs to move rigth by length of button dotRight.vPosition = new Vector2(pos.x + active.GetSize().x, pos.y - 20); // dotLeft.vPosition = new Vector2(pos.x - dotLeft.vSize.x, pos.y -20); }
// Use this for initialization void Start() { CreateProfile (); FileIO.LoadProfiles(); menuInputPlayerOne = new ControllerMenuInput(); menuInputPlayerTwo = new ControllerMenuInput(); menuInputPlayerThree = new ControllerMenuInput(); menuInputPlayerFour = new ControllerMenuInput(); menuInputPlayerOne.Init( texture , FileIO.profileContainer.profiles.Count -1 , iDotSize , fTimeBetweenMoves , GamepadInput.GamePad.Index.One); menuInputPlayerTwo.Init( texture , FileIO.profileContainer.profiles.Count -1 , iDotSize , fTimeBetweenMoves , GamepadInput.GamePad.Index.Two); menuInputPlayerThree.Init (texture, FileIO.profileContainer.profiles.Count - 1, iDotSize, fTimeBetweenMoves, GamepadInput.GamePad.Index.Three); menuInputPlayerFour.Init( texture , FileIO.profileContainer.profiles.Count -1 , iDotSize , fTimeBetweenMoves , GamepadInput.GamePad.Index.Four); lP1Buttons = new List<sButton>(); lP2Buttons = new List<sButton>(); lP3Buttons = new List<sButton>(); lP4Buttons = new List<sButton>(); //add buttons //need four sets of buttons int count = 0; // temp way to move buttons //upper left ( player 1 ) foreach( Profile p in FileIO.profileContainer.profiles ) { sButton b = new sButton(); b.Init( p.name , new Vector2( (Screen.width / 4) - standardButton.width/2 , standardButton.y + count*30) , new Vector2( standardButton.width, standardButton.height ) , LoadProfileP1 , p.name ); lP1Buttons.Add( b ); count++; } count = 0; //upper right ( player 2 ) foreach( Profile p in FileIO.profileContainer.profiles ) { sButton b = new sButton(); b.Init( p.name , new Vector2( (Screen.width / 2 + Screen.width / 4) - standardButton.width/2 , standardButton.y + count*30) , new Vector2( standardButton.width, standardButton.height ) , LoadProfileP2 , p.name ); lP2Buttons.Add( b ); count++; } //lower left ( player 3 ) count = 0; foreach( Profile p in FileIO.profileContainer.profiles ) { sButton b = new sButton(); b.Init( p.name , new Vector2( (Screen.width / 4) - standardButton.width/2 , standardButton.y + (Screen.height * fSecondRowDropPercent) + count*30) , new Vector2( standardButton.width, standardButton.height ) , LoadProfileP3 , p.name ); lP3Buttons.Add( b ); count++; } //lower right ( player 4 ) count = 0; foreach( Profile p in FileIO.profileContainer.profiles ) { sButton b = new sButton(); b.Init( p.name , new Vector2( (Screen.width / 2 + Screen.width / 4) - standardButton.width/2 , standardButton.y + (Screen.height * fSecondRowDropPercent) + count*30) , new Vector2( standardButton.width, standardButton.height ) , LoadProfileP4 , p.name ); lP4Buttons.Add( b ); count++; } }
// Use this for initialization void Start() { started = true; FileIO.LoadProfiles(); controllerMenuInput = new ControllerMenuInput(); controllerMenuInput.Init( texture , 9 , iDotSize , fTimeBetweenMoves ); controllerMenuInput.bActiveButtonConstantPressed = true; //state = new ProfileSceneState(); vSize = new Vector2( colWidth, rowHeight ); createProfileButton = new sButton(); createProfileButton.Init("Create Profile", new Vector2( colWidth / 2, rowHeight * 2 ) , vSize , CreateProfileFunc , "None" ); loadProfileButton = new sButton(); loadProfileButton.Init("Load Profile", new Vector2(200,200) , vSize , CreateProfileFunc , "None" ); exitButton = new sButton(); exitButton.Init("Exit" , new Vector2( colWidth /2 , rowHeight * 4 ) , vSize , ExitProfileButtonFunc , "Exit" ); saveButton = new sButton(); saveButton.Init("Save" , new Vector2( colWidth /2 , rowHeight * 3 ) , vSize , SaveProfileButtonFunc , "Save" ); profileButtons = new List<sButton>(); MakeProfileButtons(false); //editButtons = new List<sButton>(); editNameButton = new sButton(); editNameButton.Init("Name: " , new Vector2( rNameText.x , rNameText.y ) , new Vector2( rNameText.width, rNameText.height ) , SwitchButton , "Name" ); editAttackButton = new sButton(); editAttackButton.Init("Attack: " , new Vector2( rAttackDis.x , rAttackDis.y ) , new Vector2( rAttackDis.width, rAttackDis.height ), SwitchButton , "Attack" ); editJumpButton = new sButton(); editJumpButton.Init("Jump: " , new Vector2( rJumpDis.x , rJumpDis.y ) , new Vector2( rJumpDis.width, rJumpDis.height ), SwitchButton , "Jump" ); editPauseButton = new sButton(); editPauseButton.Init("Pause: " ,new Vector2( rPauseDis.x , rPauseDis.y ) , new Vector2( rPauseDis.width, rPauseDis.height ), SwitchButton , "Pause" ); editSwap1Button = new sButton(); editSwap1Button.Init("Swap1: " , new Vector2( rSwap1Dis.x , rSwap1Dis.y ) , new Vector2( rSwap1Dis.width, rSwap1Dis.height ) , SwitchButton , "Swap1" ); editSwap2Button = new sButton(); editSwap2Button.Init("Swap2: " ,new Vector2( rSwap2Dis.x , rSwap2Dis.y ) , new Vector2( rSwap2Dis.width, rSwap2Dis.height ) , SwitchButton , "Swap2" ); editSwap3Button = new sButton(); editSwap3Button.Init("Swap3: " ,new Vector2( rSwap3Dis.x , rSwap3Dis.y ) , new Vector2( rSwap3Dis.width, rSwap3Dis.height ), SwitchButton , "Swap3" ); editSwap4Button = new sButton(); editSwap4Button.Init("Swap4: " ,new Vector2( rSwap4Dis.x , rSwap4Dis.y ) , new Vector2( rSwap4Dis.width, rSwap4Dis.height ) , SwitchButton , "Swap4" ); editDeleteButton = new sButton(); editDeleteButton.Init("Delete Profile " ,new Vector2( rSwap4Dis.x , rSwap4Dis.y + rowHeight) , new Vector2( rSwap4Dis.width, rSwap4Dis.height ) , DeleteActiveProfileButtonFunc , "Delete" ); }
void MakeProfileButtons(bool clearList) { if(clearList) profileButtons.Clear(); float f = 0; float a = 5; // point that these start at foreach( Profile p in FileIO.profileContainer.profiles ) { sButton b = new sButton(); b.Init( "Load: " + p.name , new Vector2( colWidth / 2 , rowHeight * (a + f ) ), vSize , LoadProfile , p.name ); profileButtons.Add(b); f++; } }
// Use this for initialization void Start() { controller = new ControllerMenuInput(); controller.Init( texture , (int)(fNumOfButtons -1) , iDotSize, fTimeBetweenMoves); float fButtonCount =0; lButtons = new List<sButton>(); fScreenWidth = Screen.width; fScreenHeight = Screen.height; fSpaceForButton.y = (fScreenHeight / 2) / fNumOfButtons; fSpaceForButton.x = fScreenWidth / 4; sButton b = new sButton(); b.Init("Play", new Vector2( (fScreenWidth/2) - (fScreenWidth/8) , (fScreenHeight/2) + fSpaceForButton.y*fButtonCount) , fSpaceForButton, b.LoadLevel , PlayLevel); lButtons.Add( b ); fButtonCount++; // Button b2 = new Button(); // b2.Init("Multiplayer",new Vector2( fScreenWidth/2 - fScreenWidth/8 , fScreenHeight/2 + fSpaceForButton.y*fButtonCount) , fSpaceForButton, b2.LoadLevel , "level"); // lButtons.Add( b2 ); // fButtonCount++; sButton b3 = new sButton(); b3.Init("Profiles",new Vector2( fScreenWidth/2 - fScreenWidth/8 , fScreenHeight/2 + fSpaceForButton.y*fButtonCount) , fSpaceForButton, b3.LoadLevel , ProfilesLevel); lButtons.Add( b3 ); fButtonCount++; sButton b4 = new sButton(); b4.Init("Options",new Vector2( fScreenWidth/2 - fScreenWidth/8 , fScreenHeight/2 + fSpaceForButton.y*fButtonCount) , fSpaceForButton, b4.LoadLevel , OptionsLevel); lButtons.Add( b4 ); fButtonCount++; sButton b5 = new sButton(); b5.Init("Credits",new Vector2( fScreenWidth/2 - fScreenWidth/8 , fScreenHeight/2 + fSpaceForButton.y*fButtonCount) , fSpaceForButton, b5.LoadLevel , CreditsLevel); lButtons.Add( b5 ); fButtonCount++; sButton b6 = new sButton(); b6.Init("Exit",new Vector2( fScreenWidth/2 - fScreenWidth/8 , fScreenHeight/2 + fSpaceForButton.y*fButtonCount) , fSpaceForButton, b5.ExitGame , "Credits"); lButtons.Add( b6 ); fButtonCount++; }