void OnGUI()
    {
        //GUILayout.TextField(GetUserAgent.UserAgent_iOS);
        //GUILayout.Label(SiegeServer.Instance.ToString ());

        if(GUILayout.Button("Post"))
        {
            var msg = Time.frameCount;
            Logger.Log("broadcast msg : " + msg);
            Siege.Broadcast(msg);
        }

        if(GUILayout.Button("Listen"))
        {
            Logger.Log("subscribe");
            siege4.Subscribe((s, msg)=>{Logger.Log("subscription received : " + msg);}, SiegeSubscribeOption.Persist);
        }

        if(GUILayout.Button("Test Send Event"))
        {
            var e = new SinozeAnalyticsEvent("SinozeEvent");
            e.AddDimension("Play", "Yapid");
            SinozeAnalytics.RecordEvent(e);
        }
    }
    public void RecordEvent(SinozeAnalyticsEvent e)
    {
        var dict = new Dictionary<string, object>();

        if(e._dimensions != null)
            foreach(var a in e._dimensions)
                dict.Add(a.Key, a.Value);
        if(e._matrics != null)
            foreach(var m in e._matrics)
                dict.Add(m.Key, m.Value);

        UnityAnalytics.CustomEvent(e.Name, dict);
    }
    public void RecordEvent(SinozeAnalyticsEvent e)
    {
        var c = new CustomEvent(e.Name);

        if(e._stringMetas != null)
            foreach(var a in e._stringMetas)
                c.AddAttribute(a.Key, a.Value);
        if(e._numberMetas != null)
            foreach(var m in e._numberMetas)
                c.AddMetric(m.Key, m.Value);

        analyticsManager.RecordEvent(c);
    }
    public void RecordEvent(SinozeAnalyticsEvent e)
    {
        float? val = null;
        if(e.Value != null)
        {
            float tmp;
            if(float.TryParse(e.Value.ToString(), out tmp))
                val = tmp;
        }

        if(val.HasValue)
            GameAnalytics.NewDesignEvent(e.Name, val.Value);
        else
            GameAnalytics.NewDesignEvent(e.Name);
    }
    void OnGUI()
    {
        if(GUILayout.Button("Log GameSession:Start"))
        {
            var e = new SinozeAnalyticsEvent("GameSession", "Start", "Let it go");
            e.AddDimension("1", "Expert");
            e.AddDimension("2", "Arcade");
            e.AddMatric("1", 120);
            SinozeAnalytics.RecordEvent(e);
        }

        if(GUILayout.Button("Log GameSession:End"))
        {
            var e = new SinozeAnalyticsEvent("GameSession", "End", "Let it go");
            e.AddDimension("1", "Expert");
            e.AddDimension("2", "Arcade");
            SinozeAnalytics.RecordEvent(e);
        }
    }
    public void RecordEvent(SinozeAnalyticsEvent e)
    {
        var s = new EventHitBuilder();

        // category + action + label + value
        s.SetEventCategory(e.Category);
        s.SetEventAction(e.Action);
        s.SetEventLabel(e.Label);
        if(e.Value is int || e.Value is long)
            s.SetEventValue((long)e.Value);

        // custom dimensions
        if(e._dimensions != null)
        {
            foreach(var d in e._dimensions)
            {
                int dimensionIndex;
                if(int.TryParse(d.Key, out dimensionIndex))
                {
                    s.SetCustomDimension(dimensionIndex, d.Value);
                }
            }
        }

        // custom matrics
        if(e._matrics != null)
        {
            foreach(var m in e._matrics)
            {
                int metricIndex;
                if(int.TryParse(m.Key, out metricIndex))
                {
                    s.SetCustomMetric(metricIndex, m.Value.ToString ());
                }
            }
        }

        ga.LogEvent(s);
    }