// Use this for initialization
 void Start () {
     RequestBanner();
     var props = new Value();
     props["admobunitid"] = adBannerId;
     props["event"] = "admob-showbanner";
     Mixpanel.Track("admob-banner", props);
 }
Ejemplo n.º 2
0
        private void GoToCombinationEquipmentRecipe(int recipeId)
        {
            Mixpanel.Track("Unity/Click Guided Quest Combination Equipment");

            CombinationClickInternal(() =>
                                     Find <Combination>().ShowByEquipmentRecipe(recipeId));
        }
Ejemplo n.º 3
0
    public void FakeLogin()
    {
        // API
        APIController.SavePlayer(player.PlayerId, player.Name.Replace(" ", "%20"), player.AccessToken);

        // HeroicLabs
        Client.ApiKey = "31c210da7f0b4110bc301544870733d6";
        Client.Ping(onError);
        Client.LoginOAuthFacebook(player.AccessToken, (SessionClient session) =>
        {
            MPScript.Data.SessionClient = session;
            MPScript.Data.SessionClient.Gamer((Gamer gamer) =>
            {
                string nickname = player.Name.Replace(' ', '_');
                if (gamer.Nickname != nickname)
                {
                    MPScript.Data.SessionClient.UpdateGamer(nickname, onSuccess,
                                                            onError);
                }
            }, onError);
        }, onError);

        // Mixpanel
        Mixpanel.DistinctID = player.PlayerId;
        Mixpanel.SendEvent("DevSkip Login");
    }
Ejemplo n.º 4
0
        public override void Show(bool ignoreShowAnimation = false)
        {
            base.Show(ignoreShowAnimation);
            Mixpanel.Track("Unity/LoginImpression");

            for (var i = 0; i < slots.Length; i++)
            {
                var slot       = slots[i];
                var playerSlot = slot.GetComponent <LoginPlayerSlot>();

                if (States.Instance.AvatarStates.TryGetValue(i, out var avatarState))
                {
                    playerSlot.LabelLevel.text = $"LV.{avatarState.level}";
                    playerSlot.LabelName.text  = avatarState.NameWithHash;
                    playerSlot.CreateView.SetActive(false);
                    playerSlot.NameView.SetActive(true);
                }
                else
                {
                    playerSlot.CreateView.SetActive(true);
                    playerSlot.NameView.SetActive(false);
                }
            }

            AudioController.instance.PlayMusic(AudioController.MusicCode.SelectCharacter);
        }
Ejemplo n.º 5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            var stringBuilder = new StringBuilder();

            stringBuilder.AppendLine($"Mixpanel version: {Mixpanel.LibVersionStatic}");
            var mixpanel = Mixpanel.SharedInstanceWithToken("YOUR_TOKEN");

            // Adding this will allow us to see Mixpanel is trying to function even though it has an invalid token.
            mixpanel.EnableLogging = true;
            mixpanel.Track("This Event Happened");

            // This exists for Android but there does not seem to be a similar method call for iOS.

            /*
             * stringBuilder.AppendLine("Device info:");
             * foreach (var deviceInfo in mixpanel.DeviceInfo)
             * {
             *  stringBuilder.AppendLine($" - {deviceInfo.Key}: {deviceInfo.Value}");
             * }
             */


            MainTextView.Text = stringBuilder.ToString();
        }
        private void Awake()
        {
            // Pseudo singleton mechanism
            if (instance != null)
            {
                // There is no need for more than one Tracking Game Object
                Destroy(gameObject);
                return;
            }

            // Make this gameobject persist across the session
            DontDestroyOnLoad(this);
            instance = this;

            // Reference the Mixpanel component
            mixpanelComponent = GetComponent <Mixpanel>();

            // Make basic checks
            if (mixpanelComponent.token == "" || mixpanelComponent.debugToken == "")
            {
                Debug.LogError("No public or private token defined on Mixpanel component.", gameObject);
                return;
            }

            // Enable the Mixpanel component (disabled by default)
            mixpanelComponent.enabled = true;
        }
Ejemplo n.º 7
0
    void OnGUI()
    {
        GUI.skin = this.skin;

        GUILayout.BeginArea(new Rect(Screen.width * 0.3f, Screen.height * 0.35f, Screen.width * 0.4f, Screen.height * 2.5f));

        if (GUILayout.Button("Track"))
        {
            // a simple tracking call
            Mixpanel.Track("The Button Was Clicked1");
        }

        if (GUILayout.Button("Engage")) // an engage call
        {
            Mixpanel.people.Increment("clicks", 1);
        }

        if (GUILayout.Button("Opt Out Tracking")) // an engage call
        {
            Mixpanel.OptOutTracking();
            //  EditorUtility.DisplayDialog("Opt status", "Has opted out:  " + Mixpanel.hasOptedOut() , "Ok");
        }

        if (GUILayout.Button("Opt In Tracking")) // an engage call
        {
            Mixpanel.OptInTracking();
            // var args1 = new Value();
            // args1["test"] = 100;
            // args1["me"] = 101;
            // Mixpanel.OptInTracking("newDisctinctId2", args1);
            // EditorUtility.DisplayDialog("Opt status", "Has opted out:  " + Mixpanel.hasOptedOut() , "Ok");
        }

        GUILayout.EndArea();
    }
Ejemplo n.º 8
0
        public void CreateAndLogin(string nickName)
        {
            if (!Regex.IsMatch(nickName, GameConfig.AvatarNickNamePattern))
            {
                Find <Alert>().Show("UI_ERROR", "UI_NICKNAME_CONDITION");
                return;
            }

            Mixpanel.Track("Unity/Choose Nickname");
            Find <GrayLoadingScreen>().Show();

            Game.Game.instance.ActionManager
            .CreateAvatar(_selectedIndex, nickName, _hair,
                          _lens, _ear, _tail)
            .Subscribe(eval =>
            {
                var avatarState = States.Instance.SelectAvatar(_selectedIndex);
                StartCoroutine(CreateAndLoginAnimation(avatarState));
                ActionRenderHandler.Instance.RenderQuest(avatarState.address,
                                                         avatarState.questList.completedQuestIds);

                //[TentuPlay]
                new TPStashEvent().CharacterLogin(
                    player_uuid: States.Instance.AgentState.address.ToHex(),
                    character_uuid: States.Instance.CurrentAvatarState.address.ToHex().Substring(0, 4)
                    );
            },
                       e =>
            {
                ActionRenderHandler.PopupError(e);
                Find <GrayLoadingScreen>().Close();
            });
            AudioController.PlayClick();
        }
Ejemplo n.º 9
0
        public void DropComplete(bool value)
        {
            if (!value)
            {
                return;
            }

            dropCompleteCounter += 1;

            // if all objects have dropped, graph line chart
            if (dropCompleteCounter == objectsList.Count)
            {
                graphCreator.CreateGraph();
                dropCompleteCounter = 0;

                // show feedback
                if (gameController)
                {
                    gameController.ShowFeedbackPopup(10);
                }

                // track
                var props = new Value();
                props["Scene Name"] = SceneManager.GetActiveScene().name;
                Mixpanel.Track("Ran Simulation", props);
            }
        }
Ejemplo n.º 10
0
        void Start()
        {
            if (UnityEngine.XR.XRDevice.model == "Oculus Quest")
            {
                controllerRayCaster.RayCastEnabled = true;
                controllerRayCaster.EnableLineRenderer(true);
            }

            // once we have registered users we can use a better ID
            Mixpanel.Identify(getUniqueID());
            Mixpanel.People.Set("Headset", UnityEngine.XR.XRDevice.model);

            // set random name
            Mixpanel.People.SetOnce("$name", getRandomName());

            var props = new Value();

            props["Scene Name"] = SceneManager.GetActiveScene().name;
            Mixpanel.Track("Opened Scene", props);

            //Mixpanel.StartTimedEvent("App Session");

            if (PlayerPrefs.GetInt("hasEnteredWelcomeEmail") == 1)
            {
                feedbackPopup.SetActive(false);
            }
            else
            {
                feedbackPopup.SetActive(true);
            }

            TouchHaptics.Instance.VibrateFor(0.25f, 0.2f, 0.2f, OVRInput.Controller.Touch);
        }
Ejemplo n.º 11
0
        public void PowerButtonPress()
        {
            if (!powerOn)
            {
                powerOn        = true;
                powerText.text = "Power On";
                mainLight.TurnOn(true);
                //setCurrents(sliderControl.SliderValue);
                currentQueue.Add(sliderControl.SliderValue);
            }
            else
            {
                powerOn        = false;
                powerText.text = "Power Off";
                mainLight.TurnOn(false);
                //setCurrents(0);
                currentQueue.Add(0);

                // show feedback popup
                if (gameController)
                {
                    gameController.ShowFeedbackPopup(5);
                }
            }

            var props = new Value();

            props["Scene Name"] = SceneManager.GetActiveScene().name;
            props["Power On"]   = powerOn;
            Mixpanel.Track("Power Button Press", props);
        }
Ejemplo n.º 12
0
        public void End()
        {
            PlayerFactory.Create();

            if (PlayerPrefs.HasKey(LoginDetail.RecentlyLoggedInAvatarKey))
            {
                var recentlyLoggedAddress = PlayerPrefs.GetString(LoginDetail.RecentlyLoggedInAvatarKey);
                var matchingAddress       = State.States.Instance.AgentState.avatarAddresses
                                            .FirstOrDefault(pair => pair.Value.ToString().Equals(recentlyLoggedAddress));
                var index = matchingAddress.Equals(default(KeyValuePair <int, Address>)) ? -1 : matchingAddress.Key;

                try
                {
                    State.States.Instance.SelectAvatar(index);
                    Game.Event.OnRoomEnter.Invoke(false);
                }
                catch (KeyNotFoundException e)
                {
                    Debug.LogWarning(e.Message);
                    EnterLogin();
                }
            }
            else
            {
                EnterLogin();
            }

            Mixpanel.Track("Unity/Synopsis End");
            Close();
        }
 public void HandleOnAdLeavingApplication(object sender, EventArgs args)
 {
     var props = new Value();
     props["admobunitid"] = adBannerId;
     props["event"] = "admob-showbanner-leaveapp";
     Mixpanel.Track("admob-banner-event", props);
 }
 public void HandleOnAdClosed(object sender, EventArgs args)
 {
     var props = new Value();
     props["admobunitid"] = adBannerId;
     props["event"] = "admob-showbanner-closed";
     Mixpanel.Track("admob-banner-event", props);
 }
Ejemplo n.º 15
0
 //tracking overall player progress: sent every time the player loads up crafting
 public static void Progress()
 {
     Mixpanel.SendEvent("Progress", new Dictionary <string, object> {
         { "Elements Unlocked", GlobalVars.NUMBER_ELEMENTS_UNLOCKED },
         { "Highest Tier", Utility.HighestTierUnlocked() }
     });
 }
Ejemplo n.º 16
0
        private IEnumerator showFeedbackPopupCoroutine(float delaySeconds)
        {
            yield return(new WaitForSeconds(delaySeconds));

            // instantiate feedback popup
            feedbackPopup = (GameObject)Instantiate(feedbackPopupPrefab, new Vector3(0, 0, 0), Quaternion.identity);
            feedbackPopup.GetComponent <FeedbackPopupController>().GameController = this;

            positionPopup(feedbackPopup);

            if (audioSource)
            {
                audioSource.clip = showFeedbackPopupClip;
                audioSource.Play();
            }

            // set to seen
            PlayerPrefs.SetInt("hasSeenFeedbackPopup", 1);

            // vibrate both controllers
            TouchHaptics.Instance.VibrateFor(0.25f, 0.2f, 0.2f, OVRInput.Controller.Touch);

            popUpOpen = true;

            var props = new Value();

            props["Scene Name"] = SceneManager.GetActiveScene().name;
            Mixpanel.Track("Shown Feedback Popup", props);
        }
Ejemplo n.º 17
0
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         Mixpanel.SendEvent("Completed level " + level);
     }
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Tracks the event with a dictionary of event info.
        /// </summary>
        public void TrackEvent(string eventName, Dictionary <string, object> eventInfo)
        {
            if (this.Options == null || this.Options.Mode == AnalyticsMode.Disabled)
            {
                return;
            }

            if (!this.MixpanelInitialized)
            {
                // We do not wait for this coroutine to finish because
                // we want the first event, App Started, to definitely be
                // the first event sent, and be timed correctly.
                // The coroutine will begin the process of collecting
                // the installed apps (incl. downloading the list of apps
                // to check for), so that info will be available only
                // on later events.
                this.StartCoroutine(this.ConfigureMixpanelAsync());
                this.MixpanelInitialized = true;
            }

            if (this.Native && this.Native.HasMixpanel)
            {
                this.Native.MixpanelEvent(eventName, eventInfo);
            }
            else
            {
                Mixpanel.SendEvent(eventName, eventInfo);
            }
        }
Ejemplo n.º 19
0
 //when the players crafts their first element for the tutorial
 public static void CraftedFirstElement(string newElement)
 {
     Mixpanel.SendEvent("Crafting An Element For Crafting Tutorial",
                        new Dictionary <string, object> {
         { "Element", newElement }
     });
 }
Ejemplo n.º 20
0
        public IObservable <ActionBase.ActionEvaluation <CombinationEquipment> > CombinationEquipment(
            int recipeId,
            int slotIndex,
            int?subRecipeId = null)
        {
            Mixpanel.Track("Unity/Create CombinationEquipment");

            // 결과 주소도 고정되게 바꿔야함
            var action = new CombinationEquipment
            {
                AvatarAddress = States.Instance.CurrentAvatarState.address,
                RecipeId      = recipeId,
                SubRecipeId   = subRecipeId,
                SlotIndex     = slotIndex,
            };

            ProcessAction(action);

            return(_renderer.EveryRender <CombinationEquipment>()
                   .Where(eval => eval.Action.Id.Equals(action.Id))
                   .Take(1)
                   .Last()
                   .ObserveOnMainThread()
                   .Timeout(ActionTimeout)
                   .DoOnError(e => HandleException(action.Id, e)));
        }
Ejemplo n.º 21
0
 // Exampe people property
 // Common setup for the first use
 private static void FirstUse(string date, string distinct_id)
 {
     Mixpanel.SendPeople(new Dictionary <string, object> {
         { "First Use", date },
         { "distinct_id", distinct_id },
     }, "set_once");
 }
Ejemplo n.º 22
0
 //event for using a powerup
 public static void PowerUpUsed(string powerUpName, int powerUpLevel)
 {
     Mixpanel.SendEvent("Power Up Used", new Dictionary <string, object> {
         { "Power Up", powerUpName },
         { "Level", powerUpLevel }
     });
 }
Ejemplo n.º 23
0
    public void NextArrowSelected()
    {
        var properties = new Value();

        SetAppState(properties);

        Mixpanel.Track("Next Posts Selected", properties);
    }
Ejemplo n.º 24
0
    public void PreviousArrowSelected()
    {
        var properties = new Value();

        SetAppState(properties);

        Mixpanel.Track("Previous Posts Selected", properties);
    }
Ejemplo n.º 25
0
    public void CommentUploaded()
    {
        var properties = new Value();

        SetAppState(properties);

        Mixpanel.Track("New Comment Added To Post", properties);
    }
Ejemplo n.º 26
0
    public void FollowSelected()
    {
        var properties = new Value();

        SetAppState(properties);

        Mixpanel.Track("Began Following User", properties);
    }
Ejemplo n.º 27
0
 //when the player enters the powerup menu for the tutorial
 public static void EnteredPowerUpMenu()
 {
     if (CraftingTutorialController.CurrentTutorial == MainMenuController.Tutorial.UpgradePowerup &&
         CraftingTutorialController.TutorialActive)
     {
         Mixpanel.SendEvent("Opened PowerUp Menu For Buy Power Up Upgrade Tutorial", new Dictionary <string, object>());
     }
 }
Ejemplo n.º 28
0
 //when the player opens the crafting menu for the tutorial
 public static void EnteredCraftingMenu()
 {
     if (CraftingTutorialController.CurrentTutorial == MainMenuController.Tutorial.Crafting &&
         CraftingTutorialController.TutorialActive)
     {
         Mixpanel.SendEvent("Opened Crafting Menu For Crafting Tutorial", new Dictionary <string, object>());
     }
 }
Ejemplo n.º 29
0
 //when the player drags four elments in and the game is ready to launch
 public static void DraggedElementsInForLaunchGatheringTutorial()
 {
     if (CraftingTutorialController.CurrentTutorial == MainMenuController.Tutorial.Gathering &&
         CraftingTutorialController.TutorialActive)
     {
         Mixpanel.SendEvent("Dragged Elements in For Launch Gathering Mission Tutorial", new Dictionary <string, object>());
     }
 }
Ejemplo n.º 30
0
 //not currently in use, sent every time a player crafts an element
 public static void ElementCreated(string newElement, string parent1, string parent2, bool isNew)
 {
     Mixpanel.SendEvent("Element Created", new Dictionary <string, object> {
         { "Element", newElement },
         { "Combination", parent1 + " + " + parent2 },
         { "Is New", isNew }
     });
 }
Ejemplo n.º 31
0
        internal static void Init()
        {
            try
            {
                //This version displays the real binding error
                var mixpanel = new Mixpanel(YourMixPanelId, 1);

                //This is the recommended version to use when the binding works.
                //It returns null if the binding does not work.
                //var mixpanel = Mixpanel.SharedInstanceWithToken(YourMixpanelId);

                Debug.WriteLine("Mixpanel initialized DistinctId {0}", (object)mixpanel.DistinctId);
            }
            catch(Exception e)
            {
                Debug.WriteLine ("Error in Mixpanel SDK: {0}", (object)e.ToString());
            }
        }