public static void OnEvent(JAnalytics.Event e)
        {
            int type = e.getType();

            switch (type)
            {
            case JAnalytics.Event.BrowseEventType:
                BrowseEvent browseEven     = (BrowseEvent)e;
                string      browseId       = browseEven.getBrowseId();
                string      browseName     = browseEven.getBrowseName();
                string      browseType     = browseEven.getBrowseType();
                long        browseDuration = browseEven.getBrowseDuration();
                OnBrowseEvent(browseId, browseName, browseType, browseDuration,
                              browseEven.getExtraDic());
                break;

            case JAnalytics.Event.CalculateEventType:
                CalculateEvent calculateEvent = (CalculateEvent)e;
                string         eventId        = calculateEvent.getEventId();
                double         eventValues    = calculateEvent.getEventValued();
                OnCalculateEvent(eventId, eventValues,
                                 calculateEvent.getExtraDic());
                break;

            case JAnalytics.Event.CountEventType:
                CountEvent countEvent = (CountEvent)e;
                OnCountEvent(countEvent.getEventId(),
                             countEvent.getExtraDic());
                break;

            case JAnalytics.Event.LoginEventType:
                LoginEvent loginEvent = (LoginEvent)e;
                OnLoginEvent(loginEvent.getLoginMethod(), loginEvent.geLoginSuccess(),
                             loginEvent.getExtraDic());
                break;

            case JAnalytics.Event.PurchaseEventType:
                PurchaseEvent purchaseEvent         = (PurchaseEvent)e;
                string        purchaseGoodsid       = purchaseEvent.getPurchaseGoodsid();
                string        purchaseGoodsName     = purchaseEvent.getPurchaseGoodsName();
                double        purchasePrice         = purchaseEvent.getPurchasePrice();
                bool          purchaseSuccess       = purchaseEvent.getPurchaseSuccess();
                int           purchaseCurrencyUnity = purchaseEvent.getPurchaseCurrencyInt();
                string        purchaseGoodsType     = purchaseEvent.getPurchaseGoodsType();
                int           purchaseGoodsCount    = purchaseEvent.getPurchaseGoodsCount();
                OnPurchaseEvent(purchaseGoodsid, purchaseGoodsName, purchasePrice,
                                purchaseSuccess, purchaseCurrencyUnity, purchaseGoodsType, purchaseGoodsCount,
                                purchaseEvent.getExtraDic());
                break;

            case JAnalytics.Event.RegisterEventType:
                RegisterEvent registerEvent = (RegisterEvent)e;
                OnRegisterEvent(registerEvent.getRegisterMethod(), registerEvent.getRegisterSuccess(), registerEvent.getExtraDic());
                break;
            }
        }
Пример #2
0
        public async void SetNewVenturiData(DateTime birthday, ValueClass value)
        {
            CalculateEvent?.Invoke(this, new NewVentEventArgs($"Аппарат расcчитан"));
            CurrentVenturi.BirthayDate = birthday;
            CurrentVenturi.Value       = value;
            ModelSolid model = new ModelSolid(CurrentVenturi);

            model.CreatePart();
            await Task.Run(() => Save());
        }
Пример #3
0
 protected virtual void TrackCalcDoneEvent(TracksEventArgs e)
 {
     CalculateEvent?.Invoke(this, e);
 }
Пример #4
0
    public static void OnGUI()
    {
        str_unity = GUILayout.TextField(str_unity, GUILayout.Width(Screen.width - 80),
                                        GUILayout.Height(100));
        if (GUILayout.Button("onPageStart", GUILayout.Height(80)))
        {
            JAnalyticsBinding.OnPageStart("testOnPage-1");
        }

        if (GUILayout.Button("onPageEnd", GUILayout.Height(80)))
        {
            JAnalyticsBinding.OnPageEnd("testOnPage-1");
        }

        if (GUILayout.Button("onPurchaseEvent", GUILayout.Height(80)))
        {
            string   purchaseGoodsid       = "goodsId";
            string   purchaseGoodsName     = "篮球";
            double   purchasePrice         = 300;
            bool     purchaseSuccess       = true;
            Currency purchaseCurrencyUnity = Currency.CNY;
            string   purchaseGoodsType     = "sport";
            int      purchaseGoodsCount    = 1;

            PurchaseEvent eEvent = new PurchaseEvent(purchaseGoodsid, purchaseGoodsName,
                                                     purchasePrice, purchaseSuccess, purchaseCurrencyUnity, purchaseGoodsType, purchaseGoodsCount);
            eEvent.addKeyValue("1", "a");
            eEvent.addKeyValue("2", "b");
            JAnalyticsBinding.OnEvent(eEvent);
        }


        if (GUILayout.Button("onBrowseEvent", GUILayout.Height(80)))
        {
            string browseId       = "browse_id";
            string browseName     = "深圳热点新闻";
            string browseType     = "news";
            long   browseDuration = 30;

            BrowseEvent eEvent = new BrowseEvent(browseId, browseName,
                                                 browseType, browseDuration);
            eEvent.addKeyValue("1", "a");
            eEvent.addKeyValue("2", "b");

            JAnalyticsBinding.OnEvent(eEvent);
        }

        if (GUILayout.Button("onRegisterEvent", GUILayout.Height(80)))
        {
            string registerMethod  = "sina";
            bool   registerSuccess = true;


            RegisterEvent eEvent = new RegisterEvent(registerMethod, registerSuccess);
            eEvent.addKeyValue("1", "a");
            eEvent.addKeyValue("2", "b");


            JAnalyticsBinding.OnEvent(eEvent);
        }

        if (GUILayout.Button("onLoginEvent", GUILayout.Height(80)))
        {
            string loginMethod  = "qq";
            bool   loginSuccess = true;

            LoginEvent eEvent = new LoginEvent(loginMethod, loginSuccess);
            eEvent.addKeyValue("1", "a");
            eEvent.addKeyValue("2", "b");

            JAnalyticsBinding.OnEvent(eEvent);
        }

        if (GUILayout.Button("onCalculateEvent", GUILayout.Height(80)))
        {
            string eventId    = "onCalculateEvent_event_id";
            double eventValue = 10.1;

            CalculateEvent eEvent = new CalculateEvent(eventId, eventValue);
            eEvent.addKeyValue("1", "a");
            eEvent.addKeyValue("2", "b");

            JAnalyticsBinding.OnEvent(eEvent);
        }

        if (GUILayout.Button("onCountEvent", GUILayout.Height(80)))
        {
            string eventId = "onCountEvent_event_id";

            CountEvent eEvent = new CountEvent(eventId);
            eEvent.addKeyValue("1", "a");
            eEvent.addKeyValue("2", "b");

            JAnalyticsBinding.OnEvent(eEvent);
        }



        if (GUILayout.Button("identifyAccount", GUILayout.Height(80)))
        {
            Account account = new Account("AccountAccount");
            account.SetName("nnnnn");


            account.SetExtraAttr("k1", "v1");
            account.SetExtraAttr("k2", null);

            int                sequence             = callbackId++;
            string             gameObjectNameBack   = gameObject.name;
            string             gameObjectMethodBack = "AccountCallBack";
            JAnalyticsCallBack callBack             = new JAnalyticsCallBack(sequence, gameObjectNameBack, gameObjectMethodBack);
            JAnalyticsBinding.IdentifyAccount(account, callBack);
        }

        if (GUILayout.Button("detachAccount", GUILayout.Height(80)))
        {
            int                sequence             = callbackId++;
            string             gameObjectNameBack   = gameObject.name;
            string             gameObjectMethodBack = "AccountCallBack";
            JAnalyticsCallBack callBack             = new JAnalyticsCallBack(sequence, gameObjectNameBack, gameObjectMethodBack);

            JAnalyticsBinding.DetachAccount(callBack);
        }

        if (GUILayout.Button("setAnalyticsReportPeriod", GUILayout.Height(80)))
        {
            int period = 30;
            JAnalyticsBinding.SetAnalyticsReportPeriod(period);
        }
    }
Пример #5
0
        static void Main(string[] args)
        {
            //Array copy
            //copyArraySample();

            //Jagged array
            //jaggedArraySample();

            //ArrayList
            //arrayListSample();

            //HashTable
            //hashTableSample();

            //Generic
            //genericCollectionSample();

            //Function with dynamic parameters
            //int sum = dynamicParamsSample(10,20,30);
            //Console.WriteLine($"Sum={sum}");


            //Decimal formatting
            //decimalFormatSample();

            //Struct
            //BookStruct book1;
            //book1.Name = "C# is amazing!!";
            //book1.Price = 100;
            //BookStruct book2 = book1;
            //book1.Name = "Angular is amazing!!";
            //book1.Price = 200;

            //Console.WriteLine($"{book1.Name} : {book1.Price}");
            //Console.WriteLine($"{book2.Name} : {book2.Price}");

            //Static property
            //StaticBook js = new StaticBook() { Name = "JS" };
            //Console.WriteLine($"{js.ToString()}");
            //StaticBook cSharp = new StaticBook() { Name = "C#" };
            //Console.WriteLine($"{cSharp.ToString()}");
            //StaticBook angular = new StaticBook() { Name = "Angular" };
            //Console.WriteLine($"{angular.ToString()}");

            //Delegate
            //CalculateDelegate calculate = Calculator.Add;
            //calculate += Calculator.Minus;
            //calculate += Calculator.Divide;
            //calculate += Calculator.Multiplicate;

            //var result = calculate(5, 6);
            //Console.WriteLine($"{result}");


            //Event
            CalculateEvent += Calculator.Add;
            //calculate += Calculator.Minus;
            //calculate += Calculator.Divide;
            //calculate += Calculator.Multiplicate;

            var result = CalculateEvent?.Invoke(5, 6);

            Console.WriteLine($"{result}");



            //C# 7.0 : Nested function
            //Console.WriteLine(getTitle("JB", "Lin"));
            //string getTitle(string firstName, string lastName) => $"{lastName} {firstName}";

            //C# 7.0 : Out variable
            //getTitleByOut(out string myTitle);
            //Console.WriteLine($"Title = {myTitle}");

            //C# 7.0 : Ref returns
            //string[] names = new string[] { "JB", "Lin", string.Empty };
            //string msg = "Hello! ";
            //ref string data = ref new Program().getNameByRef(names, msg);
            //Console.WriteLine($"{msg}, {names[2]}");
            //Console.WriteLine($"{data}");



            Console.ReadKey();
        }