// Use this for initialization void Start() { AF_RGBA backgroundColor, textColor; // numberOfNotifications = 0; // af ad sdk - enable debug mode to see an ad each time // we suggest you to only keep it for debug builds! // otherwise, don't forget to comment/remove it before any store submission!!! #warning enable it for testing, disable it for store submission!! AppsfireAdSDK.SetDebugModeEnabled(true); // af sdk - connect with your sdk token / secret key #error please enter your sdk token and secret key here! AppsfireSDK.ConnectWithSDKTokenAndSecretKey("", "", AFSDKFeature.AFSDKFeatureEngage | AFSDKFeature.AFSDKFeatureMonetization); // af engage sdk - handle badge count locally and remotely AppsfireEngageSDK.HandleBadgeCountLocallyAndRemotely(true); #if UNITY_IPHONE UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge | UnityEngine.iOS.NotificationType.Sound); #endif // af engage sdk - customize background and text colors // these values are default colors, you can customize with the colors of your app backgroundColor = new AF_RGBA(66.0 / 255.0, 67.0 / 255.0, 69.0 / 255.0, 1.0); textColor = new AF_RGBA(1.0, 1.0, 1.0, 1.0); AppsfireEngageSDK.SetBackgroundAndTextColor(backgroundColor, textColor); }
void Start() { // initialize ad sdk Debug.Log("Appsfire Ad SDK - Start"); AppsfireSDK.ConnectWithAPIKey("YOUR_API_KEY_HERE", AFSDKFeature.AFSDKFeatureMonetization); AppsfireAdSDK.SetDebugModeEnabled(true); AppsfireAdSDK.Prepare(); }
void OnGUI() { string text; float centerX; GUIStyle labelStyle, buttonStyle; float minY, buttonWidth, buttonHeight, buttonMargin; // centerX = Screen.width / 2; // button style buttonStyle = new GUIStyle(GUI.skin.button); buttonStyle.fontSize = (Screen.width > 400.0) ? 32 : 16; // label style labelStyle = new GUIStyle(); labelStyle.fontSize = (Screen.width > 400.0) ? 48 : 24; labelStyle.normal.textColor = Color.black; labelStyle.alignment = TextAnchor.MiddleCenter; // button size buttonWidth = (float)Math.Floor(Screen.width * 0.80); buttonHeight = (float)Math.Floor(Screen.height * 0.09); buttonMargin = (float)Math.Floor(buttonHeight * 0.25); // label hello GUI.Label(new Rect(centerX - buttonWidth / 2.0f, buttonMargin, buttonWidth, buttonHeight), "Appsfire SDK Demo", labelStyle); minY = buttonHeight + buttonMargin * 2.0f; // button open notifications text = "Open Panel for Notifications"; if (AppsfireSDK.IsInitialized()) { text += " (" + numberOfNotifications + ")"; } if (GUI.Button(new Rect(centerX - buttonWidth / 2.0f, minY, buttonWidth, buttonHeight), text, buttonStyle)) { AppsfireEngageSDK.PresentPanelForContentAndStyle(AFSDKPanelContent.AFSDKPanelContentDefault, AFSDKPanelStyle.AFSDKPanelStyleFullscreen); } minY += buttonHeight + buttonMargin; // button open feedback if (GUI.Button(new Rect(centerX - buttonWidth / 2.0f, minY, buttonWidth, buttonHeight), "Open Panel for Feedback", buttonStyle)) { AppsfireEngageSDK.PresentPanelForContentAndStyle(AFSDKPanelContent.AFSDKPanelContentFeedbackOnly, AFSDKPanelStyle.AFSDKPanelStyleFullscreen); } minY += buttonHeight + buttonMargin; // button request modal ad (sushi) text = "Request Modal sushi"; if (GUI.Button(new Rect(centerX - buttonWidth / 2.0f, minY, buttonWidth, buttonHeight), text, buttonStyle)) { AppsfireAdSDK.RequestModalAd(AFAdSDKModalType.AFAdSDKModalTypeSushi); } minY += buttonHeight + buttonMargin; // button request modal ad (uramaki) text = "Request Modal uramaki"; if (GUI.Button(new Rect(centerX - buttonWidth / 2.0f, minY, buttonWidth, buttonHeight), text, buttonStyle)) { AppsfireAdSDK.RequestModalAd(AFAdSDKModalType.AFAdSDKModalTypeUraMaki); } }