void OnGUI() { if (Time.time % 2 < 1) { success = callBack.getResult(); } // For Setting Up ResponseBox. GUI.TextArea(new Rect(10, 5, 1300, 175), success); //=======================================EMAIL_SERVICE======================================= if (GUI.Button(new Rect(50, 200, 200, 30), "CreateMailConfiguration")) { App42Log.SetDebug(true); emailService = sp.BuildEmailService(); // Initializing Email Service. emailService.CreateMailConfiguration(cons.emailHost, cons.emailPort, cons.mailId, cons.emailPassword, cons.isSSL, callBack); } //=======================================EMAIL_SERVICE======================================= if (GUI.Button(new Rect(260, 200, 200, 30), "RemoveEmailConfiguration")) { emailService = sp.BuildEmailService(); // Initializing Email Service. emailService.RemoveEmailConfiguration(cons.mailId, callBack); } //=======================================EMAIL_SERVICE======================================= if (GUI.Button(new Rect(470, 200, 200, 30), "GetEmailConfigurations")) { emailService = sp.BuildEmailService(); // Initializing Email Service. emailService.GetEmailConfigurations(callBack); } //=======================================EMAIL_SERVICE======================================= if (GUI.Button(new Rect(680, 200, 200, 30), "SendMail")) { emailService = sp.BuildEmailService(); // Initializing Email Service. emailService.SendMail(cons.sendTo, cons.sendSubject, cons.sendMsg, cons.mailId, EmailMIME.PLAIN_TEXT_MIME_TYPE, callBack); } }
void Start() { #if UNITY_EDITOR ServicePointManager.ServerCertificateValidationCallback = Validator; #endif // Connect to the app service serviceAPI = new ServiceAPI(Constants.apiKey, Constants.secretKey); // Build the log service logService = serviceAPI.BuildLogService(); // Build Email Service emailService = serviceAPI.BuildEmailService(); // Log the event logService.SetEvent("[DEMO] Contact", "Landed", logCallBack); #region GUI stuff containerRect = new Rect(Screen.width * ((1 - containerWidth) / 2), Screen.height * ((1 - containerHeight) / 2), Screen.width * containerWidth, Screen.height * containerHeight); // Set the header style headerStyle = new GUIStyle(activeSkin.customStyles[0]); headerStyle.fontSize = (int)(Screen.height * headerFontScaling); headerStyle.padding.left = (int)(containerRect.width * labelHorPadding); headerStyle.padding.right = (int)(containerRect.width * labelHorPadding); // Set the label style labelStyle = activeSkin.label; labelStyle.fontSize = (int)(Screen.height * labelFontScaling); labelStyle.padding.left = (int)(containerRect.width * labelHorPadding); labelStyle.padding.right = (int)(containerRect.width * labelHorPadding); // set the error msg style alertMsgStyle = new GUIStyle(activeSkin.customStyles[1]); alertMsgStyle.fontSize = labelStyle.fontSize; alertMsgStyle.padding.left = (int)(containerRect.width * labelHorPadding); alertMsgStyle.padding.right = (int)(containerRect.width * labelHorPadding); // Set the textArea style txtAreaStyle = activeSkin.textArea; txtAreaStyle.fontSize = (int)(Screen.height * txtAreaFontScaling); txtAreaStyle.padding.top = (int)(txtAreaStyle.fontSize * txtAreaTopPadding); txtAreaStyle.padding.bottom = (int)(txtAreaStyle.fontSize * txtAreaBtmPadding); // Set the button styles btnWidth = Screen.width * 0.3f; btnHeight = btnWidth * ((float)activeSkin.button.normal.background.height / (float)activeSkin.button.normal.background.width); // Font scaling activeSkin.button.fontSize = (int)(btnHeight * buttonFontScaling); // Padding Scaling activeSkin.button.padding.top = (int)(activeSkin.button.fontSize * buttonTopPadding); A_btnStyle = new GUIStyle(activeSkin.button); B_btnStyle = new GUIStyle(activeSkin.button); // Calculate positions #region positioning // initialise variable to calculate total height float totalHeight = 0; float frameWidth = Screen.width * innerFrameWidth; // header label labelHeight = headerStyle.fontSize * fontHeightScale + headerStyle.padding.top + headerStyle.padding.bottom; headerRect = new Rect(0, totalHeight, frameWidth, labelHeight); totalHeight += labelHeight; // name label labelHeight = labelStyle.fontSize * fontHeightScale + labelStyle.padding.top + labelStyle.padding.bottom; label_NameRect = new Rect(0, totalHeight, frameWidth, labelHeight); totalHeight += labelHeight; // sender's name txtAreaHeight = txtAreaStyle.fontSize * fontHeightScale + txtAreaStyle.padding.top + txtAreaStyle.padding.bottom; txtArea_NameRect = new Rect(0, totalHeight, frameWidth, txtAreaHeight); totalHeight += txtAreaHeight; // email label labelHeight = labelStyle.fontSize * fontHeightScale + labelStyle.padding.top + labelStyle.padding.bottom; label_EmailRect = new Rect(0, totalHeight, frameWidth, labelHeight); totalHeight += labelHeight; // sender's email txtAreaHeight = txtAreaStyle.fontSize * fontHeightScale + txtAreaStyle.padding.top + txtAreaStyle.padding.bottom; txtArea_EmailRect = new Rect(0, totalHeight, frameWidth, txtAreaHeight); totalHeight += txtAreaHeight; // email subject label labelHeight = labelStyle.fontSize * fontHeightScale + labelStyle.padding.top + labelStyle.padding.bottom; label_EmailSubjectRect = new Rect(0, totalHeight, frameWidth, labelHeight); totalHeight += labelHeight; // email subject txtAreaHeight = txtAreaStyle.fontSize * fontHeightScale + txtAreaStyle.padding.top + txtAreaStyle.padding.bottom; txtArea_EmailSubjectRect = new Rect(0, totalHeight, frameWidth, txtAreaHeight); totalHeight += txtAreaHeight; // email body txtAreaHeight = (txtAreaStyle.fontSize * fontHeightScale) * 5 + txtAreaStyle.padding.top + txtAreaStyle.padding.bottom; txtArea_EmailBodyRect = new Rect(0, totalHeight, frameWidth, txtAreaHeight); totalHeight += txtAreaHeight; // main menu and submit buttons A_btnRect = new Rect(0, totalHeight, btnWidth, btnHeight); B_btnRect = new Rect(frameWidth - btnWidth, totalHeight, btnWidth, btnHeight); totalHeight += btnHeight; // Initialise button scalers A_btnScale = new ButtonHandler(A_btnRect, gameObject, 0.9f, "A_ScaleButton"); B_btnScale = new ButtonHandler(B_btnRect, gameObject, 0.9f, "B_ScaleButton"); #endregion innerFrameRect = new Rect(0, 0, frameWidth, totalHeight); innerFrameHeight = totalHeight; #endregion }