void onLogoClick( CEvent e ) {
	
		if( Application.absoluteURL.IndexOf( "uniswf.com" ) == -1 ) {
			Application.OpenURL("http://uniswf.com");			
		}
		
	}
Esempio n. 2
0
    private static void OnProductPurchased(CEvent e)
    {
        BillingResult result = e.data as BillingResult;

        //this flag will tell you if purchase is available
        //result.isSuccess


        //infomation about purchase stored here
        //result.purchase

        //here is how for example you can get product SKU
        //result.purchase.SKU


        if (result.isSuccess)
        {
            OnProcessingPurchasedProduct(result.purchase);
        }
        else
        {
            AndroidMessage.Create("Product Purchase Failed", result.response.ToString() + " " + result.message);
        }

        Debug.Log("Purchased Responce: " + result.response.ToString() + " " + result.message);
    }
Esempio n. 3
0
 private void onRemovedFromStage( CEvent e )
 {
     removeEventListener(CEvent.ADDED_TO_STAGE, onAddedToStage);
     removeEventListener(CEvent.ADDED_TO_STAGE, onRemovedFromStage);
     stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
     stage.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
 }
Esempio n. 4
0
    private void OnAchievementProgress(CEvent e)
    {
        Debug.Log ("OnAchievementProgress");

        AchievementTemplate tpl = e.data as AchievementTemplate;
        Debug.Log (tpl.id + ":  " + tpl.progress.ToString());
    }
Esempio n. 5
0
	private void onRatePopUpClose(CEvent e)
    {
#if UNITY_WP8 
		(e.dispatcher as WP8RateUsPopUp).removeEventListener(BaseEvent.COMPLETE, onRatePopUpClose);
		string result = e.data.ToString();
		WP8PopUps.PopUp.ShowMessageWindow("Result", result + " button pressed");
#endif
    }
Esempio n. 6
0
 public void dispatchEvent(ref CEvent evt)
 {
     if(m_szListener.ContainsKey(evt.type))
     {
         ListenerProc procs = m_szListener[evt.type];
         procs.Invoke(evt);
     }
 }
Esempio n. 7
0
 private void RotateRHandler(CEvent e)
 {
     if (lastObject != null)
     {
         lastObject.transform.Rotate(new Vector3(lastObject.transform.localRotation.x, lastObject.transform.localRotation.y, lastObject.transform.localRotation.z - 1.5f));
         print("Rotated Right: " + lastObject.transform.localRotation.z);
     }
 }
Esempio n. 8
0
 private void hInc(CEvent e)
 {
     if (lastObject != null)
     {
         lastObject.transform.localScale = new Vector3(lastObject.transform.localScale.x, lastObject.transform.localScale.y + 0.1f, lastObject.transform.localScale.z);
         print("Height Scaled Up" + lastObject.transform.localScale.y);
     }
 }
    //--------------------------------------
    //  GET/SET
    //--------------------------------------
    //--------------------------------------
    //  EVENTS
    //--------------------------------------
    private void OnTokenReived(CEvent e)
    {
        IOSNotificationDeviceToken token = e.data as IOSNotificationDeviceToken;
        Debug.Log ("OnTokenReived");
        Debug.Log (token.tokenString);

        IOSNotificationController.instance.removeEventListener (IOSNotificationController.DEVICE_TOKEN_RECIVED, OnTokenReived);
    }
Esempio n. 10
0
	private void onDialogClose(CEvent e) {

		//removing listner
		(e.dispatcher as WP8Dialog).removeEventListener(BaseEvent.COMPLETE, onDialogClose);

		string result = e.data.ToString();
		WP8PopUps.PopUp.ShowMessageWindow("Result", result + " button pressed");
	}
Esempio n. 11
0
	private void OnConnectFinished(CEvent e) {
		UM_BillingConnectionResult result = e.data as UM_BillingConnectionResult;
		if(result.isSuccess) {
			Debug.Log("Billing init Success");
		//	UM_InAppPurchaseManager.instance.RestorePurchases();
		} else  {
			Debug.Log ("Billing init Failed");
		}
	}
    private void OnGCDataRecived(CEvent e)
    {
        GameCenterDataPackage package = e.data as GameCenterDataPackage;

        System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
        string str = enc.GetString(package.buffer);

        IOSNative.showMessage ("Data recived", "player ID: " + package.playerID + " \n " + "data: " + str);
    }
Esempio n. 13
0
 private void OnDataReceive(CEvent e)
 {
     iCloudData data = e.data as iCloudData;
     if(data.IsEmpty) {
         IOSNativePopUpManager.showMessage(data.key, "data is empty");
     } else {
         IOSNativePopUpManager.showMessage(data.key, data.stringValue);
     }
 }
	void onLog( CEvent e ) {
		
		LogEvent logEvent = e as LogEvent;
		
		debug_txt.alpha = 1;
		debug_txt.text = logEvent.logStr;	
			
		Tweener.addTween( debug_txt, Tweener.Hash( "time", 1, "alpha", 0, "delay", 3 ) );		
	}
Esempio n. 15
0
	private void onButtonClickData(CEvent e) {
		Debug.Log("================================");
		Debug.Log("onButtonClickData");
			
		Debug.Log("dispatcher: " + e.dispatcher.ToString());
		Debug.Log("event data: " + e.data.ToString());
		Debug.Log("event name: " + e.name.ToString());
		Debug.Log("================================");
	}
Esempio n. 16
0
    /// <summary>
    /// 大招引导特效开始
    /// </summary>
    /// <param name="c">C.</param>
    void BattleUltLoadHandler(CEvent c)
    {
        ShakeBg ();

        AudioManager.SharedInstance.PlayOneShot ("ty05", 3.0f);

        AttackMessage message = (AttackMessage)c.data;
        StartCoroutine ("PlayUltEffect", message);
    }
Esempio n. 17
0
 internal static SRes Event_Reset(CEvent p)
 {
     #if !DISABLE_TRACE
     Trace.MatchObjectWait(p, "Event_Reset");
     #else
     p.Event.Reset();
     #endif
     return TSZ("Event_Reset");
 }
Esempio n. 18
0
	public void onUnloadAssetBundle( CEvent e ) {
		
		Debug.Log( "onUnloadAssetBundle" );
		
		BuiltinResourceLoader loader = MovieClip.rootResourceLoader as BuiltinResourceLoader;
		loader.removeAssetBundle( loadedBundle );
		
		// Attempt to load unloaded mc, should error
		/*MovieClip mc =*/ new MovieClip( "assetBundleAssets0.swf:Zombie" );
	}
Esempio n. 19
0
 internal static SRes AutoResetEvent_CreateNotSignaled(out CEvent p)
 {
     p = new CEvent();
     #if !DISABLE_TRACE
     Trace.MatchObjectCreate(p, "Event_Create");
     #else
     p.Event = new System.Threading.AutoResetEvent(false);
     #endif
     return TSZ("Event_Create");
 }
Esempio n. 20
0
    // Tiles
    void onItemTileMouseDown( CEvent evt ) {
        MouseEvent e = evt as MouseEvent;

	    // Set button hilite
	    (e.currentTarget as MovieClip).gotoAndStop( 2 );
	
	    // Zoom when clicking
	    zSpacePosAnimOffsetTarget = 0.5f;
	
	    targetPitch = 0.8f;
    }
	private static void OnPurchaseFinished(CEvent e) {
		WP8PurchseResponce recponce = e.data as WP8PurchseResponce;

		if(recponce.IsSuccses) {
			//Unlock logic for product with id recponce.productId should be here
			WP8Dialog.Create("Purchase Succse", "Product: " + recponce.productId);
		} else {
			//Purchase fail logic for product with id recponce.productId should be here
			WP8Dialog.Create("Purchase Failed", "Product: " + recponce.productId);
		}
	}
    private void OnGCDataReceived(CEvent e)
    {
        #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE
        GameCenterDataPackage package = e.data as GameCenterDataPackage;

        System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
        string str = enc.GetString(package.buffer);

        IOSNativePopUpManager.showMessage ("Data received", "player ID: " + package.playerID + " \n " + "data: " + str);
        #endif
    }
Esempio n. 23
0
 internal static void Event_Close(ref CEvent p)
 {
     if (p != null)
     {
     #if !DISABLE_TRACE
         Trace.MatchObjectDestroy(p, "Event_Close");
     #else
         p.Event.Close();
     #endif
     }
     p = null;
 }
Esempio n. 24
0
    //--------------------------------------
    //  PUBLIC METHODS
    //--------------------------------------
    //--------------------------------------
    //  GET/SET
    //--------------------------------------
    //--------------------------------------
    //  EVENTS
    //--------------------------------------
    private void OnData(CEvent e)
    {
        GameCenterDataPackage package = e.data as GameCenterDataPackage;

        ByteByffer b = new ByteByffer (package.buffer);

        Vector3 pos = new Vector3 (0, 0, 1);
        pos.x = b.readFloat ();
        pos.y = b.readFloat ();

        PTPGameController.instance.createRedSphere (pos);
    }
Esempio n. 25
0
	void OnRatePopUpClose(CEvent e) {
		//parsing result
		switch((MNDialogResult)e.data) {
		case MNDialogResult.RATED:
			PlayerPrefs.SetInt("rateus", 1);
			break;
		case MNDialogResult.REMIND:
			break;
		case MNDialogResult.DECLINED:
			PlayerPrefs.SetInt("rateus", 1);
			break;
		}
	}
Esempio n. 26
0
	void OnDialogClose(CEvent e) {
		//removing listner
		e.dispatcher.removeEventListener(BaseEvent.COMPLETE, OnDialogClose);
		//parsing result
		switch((MNDialogResult)e.data) {
		case MNDialogResult.YES:
			Application.Quit ();
			break;
		case MNDialogResult.NO:
			return;
			break;
		}
	}
Esempio n. 27
0
 private void ExpansionHandler(CEvent e)
 {
     if (expandToggled == false)
     {
         expandToggled = true;
         print(expandToggled);
     }
     else if (expandToggled == true)
     {
         expandToggled = false;
         print(expandToggled);
     }
 }
	private void OnRetrieveProductsFinised(CEvent e) {
		Debug.Log("OnRetrieveProductsFinised");
		BillingResult result = e.data as BillingResult;
		AndroidInAppPurchaseManager.instance.removeEventListener (AndroidInAppPurchaseManager.ON_RETRIEVE_PRODUC_FINISHED, OnRetrieveProductsFinised);
		
		if(result.isSuccess) {
			Debug.Log("OnRetrieveProductsFinised COMPLETE");
			dispatch(BaseEvent.COMPLETE);
		} else {
			Debug.Log("OnRetrieveProductsFinised FAILED");
			dispatch(BaseEvent.FAILED);
		}
	}
Esempio n. 29
0
    private void onTouch(CEvent e)
    {
        var localPos = (e as MouseEvent);
        var clipRect = mContents.clipRect;
        clipRect.x = localPos.stageX; //- (clipRect.width  * 0.5f);
        clipRect.y = localPos.stageY; //- (clipRect.height * 0.5f);

        if(clipRect.y > 480) clipRect.y = 480;
        mContents.clipRect = clipRect;

        mClipQuad.x = clipRect.x;
        mClipQuad.y = clipRect.y;
    }
Esempio n. 30
0
	//--------------------------------------
	//  EVENTS
	//--------------------------------------

	private void OnStateConflict(CEvent e) {
		GoogleCloudResult result = e.data as GoogleCloudResult;
		AN_PoupsProxy.showMessage ("OnStateUpdated", result.message 
		                           + "\n State ID: " + result.stateKey 
		                           + "\n State Data: " + result.stateData
		                           + "\n State Conflict: " + result.serverConflictData
		                           + "\n State resolve: " + result.resolvedVersion);

		//Resolving conflict with our local data
		//you should create your own resolve logic for your game. Read more about resolving conflict on Android developer website

		GoogleCloudManager.instance.resolveState (result.stateKey, result.stateData, result.resolvedVersion);
	}
Esempio n. 31
0
    private void onDialogClose(CEvent e)
    {
        //romoving listner
        (e.dispatcher as IOSDialog).removeEventListener(BaseEvent.COMPLETE, onDialogClose);

        //parsing result
        switch ((IOSDialogResult)e.data)
        {
        case IOSDialogResult.YES:
            Debug.Log("Yes button pressed");
            break;

        case IOSDialogResult.NO:
            Debug.Log("No button pressed");
            break;
        }

        string result = e.data.ToString();

        IOSNativePopUpManager.showMessage("Result", result + " button pressed");
    }
Esempio n. 32
0
        void OnTrigger(CEvent eve)
        {
            TaskState tag = (TaskState)eve.GetParam("TaskState");

            switch (tag)
            {
            case TaskState.TaskEnd:
                effect.OnEnd();
                EventCenter.RemoveListener <CEvent>((EGameEvent)taskData.EndTaskEvent, OnTrigger);
                if (taskData.IsMask)
                {
                    effect.ShowMark(false, null);
                }
                iParent.CheckNextTask();
                SkipNewsGuideEnd();
                effect = null;
                break;

            case TaskState.TaskShow:
                //if (ConnectMsg.Instance == null)
            {
                if (taskData.TaskId == newsGuideTaskId && objSkipNewsGuide != null)
                {
                    return;
                }
                effect.OnEnter();
            }
            break;

            case TaskState.TaskMark:
                List <GameObject> objList = (List <GameObject>)eve.GetParam("Mark");
                //objList = (ConnectMsg.Instance != null && ConnectMsg.Instance.gameObject.activeInHierarchy) ? null : objList;
                if (taskData.IsMask)
                {
                    effect.ShowMark(true, objList);
                }
                SkipNewsGuideMark(objList);
                break;
            }
        }
        public void AcceptEvent(CEvent e)
        {
            if (e is SetTargetInputEvent setE)
            {
                Quaternion rot = Quaternion.Euler(-90f, 0f, 0f);

                Vector3 temp = new Vector3(setE.input.x, 0f, setE.input.y);

                targetInput = rot * worldSpaceToCoordinateSpace.MultiplyVector(inputRotation * temp);
            }
            if (e is InpulseEvent inpulseE)
            {
                Vector3 inpulse = inpulseE.inpulse;
                if (!inpulseE.inWorldSpace)
                {
                    inpulse = coordinateSpaceToWorldSpace.MultiplyVector(inpulse);
                }

                if (inpulseE.isHard)
                {
                    ProjectToInpulse(inpulse);
                }
                else
                {
                    AddInpulse(inpulse);
                }
            }
            if (e is CrouchEvent)
            {
                Crouch();
            }
            if (e is UnCrouchEvent)
            {
                UnCrouch();
            }
            if (e is CrouchToggleEvent)
            {
                ToggleCrouch();
            }
        }
        public ActionResult Create(CEvent myEvent)
        {
            //add the times of the the event to the date
            myEvent.start = myEvent.EventDate + myEvent.StartTime;
            myEvent.end   = myEvent.EventDate + myEvent.EndTime;

            //add other Event propeties createdBy etc...

            //Do we try and add the image here then do check on model valid state?
            try
            {
                context.Add <CEvent>(myEvent);
                context.SaveChanges();
            }
            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    //Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                    //eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        //Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                        //ve.PropertyName, ve.ErrorMessage);
                        ModelState.AddModelError(ve.PropertyName, ve.ErrorMessage);
                    }
                }
            }

            if (!ModelState.IsValid)
            {
                return(PartialView("_EventDialogue", myEvent));
            }
            else
            {
                var redirectUrl = new UrlHelper(Request.RequestContext).Action("Index", "Home");
                return(Json(new { Url = redirectUrl }));
            }
        }
Esempio n. 35
0
        public override void Compile(string path)
        {
            var res = new EventResource(Path.Combine(RootDirectory, path));

            var cevent = new CEvent();

            cevent.MinDelay = res.MinDelay;
            cevent.MaxDelay = res.MaxDelay;
            Writer.WriteStruct(cevent);

            Writer.Write(res.Actions.Count);
            foreach (var a in res.Actions)
            {
                var    caction = new CAction();
                string link    = ResolveLink(path, a.Tile);
                caction.LinkID  = Table[link];
                caction.Type    = (int)a.Type;
                caction.OffsetX = a.OffsetX;
                caction.OffsetY = a.OffsetY;
                Writer.WriteStruct(caction);
            }
        }
Esempio n. 36
0
        public async Task <IEnumerable <CEvent> > importCSV(List <CEvent> model, int id)
        {
            List <CEvent> data = model;

            using (db)
            {
                foreach (var item in data)
                {
                    CEvent obj = new CEvent();
                    obj.Title       = item.Title;
                    obj.Description = item.Description;
                    obj.StartDate   = item.StartDate;
                    obj.EndDate     = item.EndDate;
                    obj.ImagePath   = item.ImagePath;
                    obj.LoginID     = item.LoginID;
                    db.CEvents.Add(obj);
                }
                db.SaveChanges();
                string ac = "Completed";
                return(null);
            }
        }
Esempio n. 37
0
        public async Task <IEnumerable <CEvent> > DummyData(int id)
        {
            List <CEvent> model = new List <CEvent>();

            using (db)
            {
                List <CEvent> query = db.CEvents.Where(x => x.LoginID == id).ToList();

                foreach (var item in query)
                {
                    CEvent models = new CEvent();
                    models.Title       = item.Title;
                    models.Description = item.Description;
                    models.StartDate   = item.StartDate;
                    models.EndDate     = item.EndDate;
                    models.ImagePath   = item.ImagePath;
                    model.Add(models);
                }
                ;
            }
            return(model);
        }
Esempio n. 38
0
    private void OnLeaderBoardsLoaded(CEvent e)
    {
        GooglePlayManager.instance.removeEventListener(GooglePlayManager.LEADERBOARDS_LOEADED, OnLeaderBoardsLoaded);

        GooglePlayResult result = e.data as GooglePlayResult;

        if (result.isSuccess)
        {
            if (GooglePlayManager.instance.GetLeaderBoard(LEADERBOARD_ID) == null)
            {
                AndroidNative.showMessage("Leader boards loaded", LEADERBOARD_ID + " not found in leader boards list");
                return;
            }


            AndroidNative.showMessage(LEADERBOARD_NAME + "  score", GooglePlayManager.instance.GetLeaderBoard(LEADERBOARD_ID).GetScore(GPCollectionType.COLLECTION_PUBLIC, GPBoardTimeSpan.TIME_SPAN_ALL_TIME).ToString());
        }
        else
        {
            AndroidNative.showMessage("OnLeaderBoardsLoaded error: ", result.message);
        }
    }
Esempio n. 39
0
    private void onGetResult(CEvent evt)
    {
        //  throw new NotImplementedException();

        UnityThreadHelper.Dispatcher.Dispatch(() =>
        {
            //            var parms = evt.eventParams;
            //
            //            Debug.Log("完成一局,结果返回" + JsonConvert.SerializeObject(parms));


            RoomEvent parms = (RoomEvent)evt.eventParams;

            var room = parms.room;


            TinyRoomCS ts = ConvertTool.ConvertRoom(room);


            Debug.Log("房间发牌" + JsonConvert.SerializeObject(ts));
        });
    }
Esempio n. 40
0
    private void Android_OnRetrieveProductsFinised(CEvent e)
    {
        _IsInited = true;

        BillingResult result = e.data as BillingResult;

        AndroidInAppPurchaseManager.instance.removeEventListener(AndroidInAppPurchaseManager.ON_RETRIEVE_PRODUC_FINISHED, Android_OnRetrieveProductsFinised);

        UM_BillingConnectionResult r = new UM_BillingConnectionResult();

        r.message              = result.message;
        r.isSuccess            = result.isSuccess;
        _IsPurchasingAvailable = r.isSuccess;
        if (r.isSuccess)
        {
            foreach (UM_InAppProduct product in UltimateMobileSettings.Instance.InAppProducts)
            {
                GoogleProductTemplate tpl = AndroidInAppPurchaseManager.instance.inventory.GetProductDetails(product.AndroidId);
                if (tpl != null)
                {
                    product.SetTemplate(tpl);
                    if (product.IsConsumable && AndroidInAppPurchaseManager.instance.inventory.IsProductPurchased(product.AndroidId))
                    {
                        AndroidInAppPurchaseManager.instance.consume(product.AndroidId);
                    }

                    if (!product.IsConsumable && AndroidInAppPurchaseManager.instance.inventory.IsProductPurchased(product.AndroidId))
                    {
                        SaveNonConsumableItemPurchaseInfo(product);
                    }
                }
            }
        }


        OnBillingConnectFinishedAction(r);
        dispatch(ON_BILLING_CONNECT_FINISHED, r);
    }
Esempio n. 41
0
        private void onTouch(CEvent e)
        {
            //Mouse.cursor = (mUseHandCursor && mEnabled && event.interactsWith(this)) ?
            //    MouseCursor.BUTTON : MouseCursor.AUTO;

            //MouseEvent mouseEvent = e as MouseEvent;

            //Touch touch = e.getTouch(this);
            //Touch touch = mouseEvent.touch;

            /*if (!mEnabled || touch == null) return;
             *
             * if (touch.phase == TouchPhase.Began && !mIsDown)
             * {
             *  //mBackground.texture = mDownState;
             *  mContents.scaleX = mContents.scaleY = mScaleWhenDown;
             *  mContents.x = (1.0f - mScaleWhenDown) / 2.0f * mBackground.width;
             *  mContents.y = (1.0f - mScaleWhenDown) / 2.0f * mBackground.height;
             *  mIsDown = true;
             * }
             * else if (touch.phase == TouchPhase.Moved && mIsDown)
             * {
             *  // reset button when user dragged too far away after pushing
             *  Rectangle buttonRect = getBounds(stage);
             *  if (touch.position.x < buttonRect.x - MAX_DRAG_DIST ||
             *      touch.position.y < buttonRect.y - MAX_DRAG_DIST ||
             *      touch.position.x > buttonRect.x + buttonRect.width + MAX_DRAG_DIST ||
             *      touch.position.y > buttonRect.y + buttonRect.height + MAX_DRAG_DIST)
             *  {
             *      resetContents();
             *  }
             * }
             * else if (touch.phase == TouchPhase.Ended && mIsDown)
             * {
             *  resetContents();
             *  //dispatchEventWith(Event.TRIGGERED, true);
             * }*/
        }
Esempio n. 42
0
    private void Android_OnBillingConnected(CEvent e)
    {
        BillingResult result         = e.data as BillingResult;
        UM_BillingConnectionResult r = new UM_BillingConnectionResult();

        AndroidInAppPurchaseManager.instance.removeEventListener(AndroidInAppPurchaseManager.ON_BILLING_SETUP_FINISHED, Android_OnBillingConnected);


        if (result.isSuccess)
        {
            //Store connection is Successful. Next we loading product and customer purchasing details
            r.isSuccess = true;
            AndroidInAppPurchaseManager.instance.retrieveProducDetails();
        }
        else
        {
            r.isSuccess = false;
            dispatch(ON_BILLING_CONNECT_FINISHED, r);
        }


        r.message = result.message;
    }
Esempio n. 43
0
 void OnEventStart(CEvent eve)
 {
     if (isFinish)
     {
         return;
     }
     if (data == null)
     {
         return;
     }
     if (EventCenter.mEventTable != null && EventCenter.mEventTable.ContainsKey((EGameEvent)data.helpTriggerEvent))
     {
         EventCenter.RemoveListener <CEvent>((EGameEvent)data.helpTriggerEvent, OnEventStart);
     }
     taskEffect = new SecondaryTaskEffect(this);
     taskEffect.OnEnter();
     sTimes += 1;
     if (sTimes >= data.helpTimes)
     {
         OnCommit(); //只是提交任务,但是显示效果可能还在继续
     }
     EventCenter.AddListener <CEvent>((EGameEvent)(data.helpTriggerEvent + endTaskBetween), OnEventEnd);
 }
Esempio n. 44
0
        private void onMouseUp(CEvent e)
        {
            //MouseEvent mouseEvent = e as MouseEvent;
            //Touch touch = mouseEvent.touch;

            if (!mEnabled)
            {
                return;
            }

            /*Rectangle buttonRect = getBounds(stage);
             * if (touch.position.x < buttonRect.x - MAX_DRAG_DIST ||
             *  touch.position.y < buttonRect.y - MAX_DRAG_DIST ||
             *  touch.position.x > buttonRect.x + buttonRect.width + MAX_DRAG_DIST ||
             *  touch.position.y > buttonRect.y + buttonRect.height + MAX_DRAG_DIST)
             * {
             *  resetContents();
             * }*/

            resetContents();

            dispatchEvent(new CEvent(Button.BUTTON_CLICKED, true, true));
        }
Esempio n. 45
0
        private void onMouseDown(CEvent e)
        {
            MouseEvent mouseEvent = e as MouseEvent;
            Touch      touch      = mouseEvent.touch;

            if (!mEnabled)
            {
                return;
            }

            if (touch.phase == TouchPhase.Began && !mIsDown)
            {
                mBackground = mDownState;
                addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
                addEventListener(MouseEvent.MOUSE_LEAVE, onMouseLeave);

                mContents.scaleX = mContents.scaleY = mScaleWhenDown;
                mContents.x      = (1.0f - mScaleWhenDown) / 2.0f * mBackground.width;
                mContents.y      = (1.0f - mScaleWhenDown) / 2.0f * mBackground.height;
                mIsDown          = true;
                //Debug.Log( "mouse down" );
            }
        }
    private void OnBillingConnected(CEvent e)
    {
        Debug.Log("OnBillingConnected");
        if (e == null)
        {
            OnBillingConnectFinished();
            return;
        }

        BillingResult result = e.data as BillingResult;

        AndroidInAppPurchaseManager.instance.removeEventListener(AndroidInAppPurchaseManager.ON_BILLING_SETUP_FINISHED, OnBillingConnected);


        if (result.isSuccess)
        {
            OnBillingConnectFinished();
        }
        else
        {
            Debug.Log("OnBillingConnected Failed");
            dispatch(BaseEvent.FAILED);
        }
    }
Esempio n. 47
0
 internal static void Event_Construct(out CEvent p)
 {
     p = null;
 }
Esempio n. 48
0
 public SyncAutoResetEvent(bool initialState)
 {
     _cEvent = new CEvent(true, initialState);
 }
Esempio n. 49
0
 internal static SRes Event_Reset(CEvent p)
 {
     p.Event.Reset();
     return(TSZ("Event_Reset"));
 }
Esempio n. 50
0
 private void onTestEventList(CEvent evt)
 {
     Debug.Log("收到事件拉." + evt.eventParams);
 }
Esempio n. 51
0
 private void onReg(CEvent evt)
 {
 }
Esempio n. 52
0
    private void onGetRoomInfo(CEvent evt)
    {
        UnityThreadHelper.Dispatcher.Dispatch(() =>
        {
            RoomEvent parms = (RoomEvent)evt.eventParams;

            var room = parms.room;


            Debug.Log("room" + room);
            TinyRoomCS ts = ConvertTool.ConvertRoom(room);


            var idle          = 0; // 空闲;
            var ready         = 1; // 准备状态
            var playing       = 2; // 玩;
            var start         = 2;
            var dispath       = 3;
            var qiangzhuang   = 4; // 抢庄
            var settingZhuang = 5; //设置庄
            var gamebling     = 6; // 下注
            var switchTimes   = 7; ////设置倍数。如:两点一倍,炸弹四倍
            var roundFinish   = 8; // 一局结束
            var over          = 9; // 游戏结束;


            Debug.Log("获取信息房间" + JsonConvert.SerializeObject(ts));

            switch (ts.status)
            {
            case 0:
                Debug.Log("<color=#9400D3>空闲</color>");
                break;

            case 1:
                Debug.Log("<color=#9400D3>准备</color>");
                break;

            case 2:
                Debug.Log("<color=#9400D3>开始</color>");
                break;

            case 3:
                Debug.Log("<color=#9400D3>发牌</color>");
                break;

            case 4:
                Debug.Log("<color=#9400D3>抢庄</color>");
                break;

            case 5:
                Debug.Log("<color=#9400D3>设置庄</color>");
                break;

            case 6:
                Debug.Log("<color=#9400D3>下注</color>");
                break;

            case 7:
                Debug.Log("<color=#9400D3>设置倍数</color>");     //用于开房间,一共有几局
                break;

            case 8:
                Debug.Log("<color=#9400D3>本轮结束</color>");     //用于开房间,一共有几局
                break;

            case 9:
                Debug.Log("<color=#9400D3>游戏结束</color>");     //用于开房间,一共有几局
                break;
            }


            var ps = ts.players;
            //2019-11-27
            foreach (TinyPlayerCS cs in ps)
            {
                if (dic == null)
                {
                    dic = new Dictionary <int, PlayerCS>();
                }

                if (!dic.ContainsKey(cs.id))
                {
                    dic[cs.id] = new PlayerCS(null);


                    var player = dic[cs.id];


                    if (player.data == null)
                    {
                        player.installDataCS(JsonConvert.SerializeObject(cs));
                    }

                    player.addEvent();

                    player.addEventListener(PlayerEvent.ADD_BET, onAddBet); //倾听下注,还可以倾听用户 的表情,语音,等。
                }
            }
        });
    }
    private void UrlExcists(CEvent e)
    {
        string url = e.data as string;

        IOSMessage.Create("Url Exists", "The " + url + " is registred");
    }
Esempio n. 54
0
 internal static bool Event_IsCreated(CEvent p)
 {
     return(p != null);
 }
Esempio n. 55
0
 internal static SRes Event_Wait(CEvent p)
 {
     p.Event.WaitOne();
     return(TSZ("Event_Wait"));
 }
Esempio n. 56
0
    private void onCSOpen(CEvent evt)
    {
        var ps = evt.eventParams;

        Debug.Log("事件听到了?" + ps);
    }
Esempio n. 57
0
 internal static SRes AutoResetEvent_CreateNotSignaled(out CEvent p)
 {
     p       = new CEvent();
     p.Event = new System.Threading.AutoResetEvent(false);
     return(TSZ("Event_Create"));
 }
Esempio n. 58
0
 public void Apply(MyAggregate aggregate, CEvent @event)
 {
     aggregate.CCount++;
 }
Esempio n. 59
0
        /// <summary>
        /// Reads the TOU Schedule from the meter into a TOUSchedule object
        /// </summary>
        /// <returns>The TOU Schedule object.</returns>
        // Revision History
        // MM/DD/YY who Version Issue#  Description
        // -------- --- ------- ------  ---------------------------------------
        // 01/04/07 RCG 8.00.04		    Made more generic and promoted from CENTRON_AMI
        // 04/13/07 RCG 8.00.31 2919    Adding support for Output events.
        // 03/10/08 KRC 1.50.02         Adding Ability to create TOU Schedule from EDL file
        //  12/03/10 DEO 9.70.13        Promoted from ANSIDevice

        public static CTOUSchedule ReadCENTRON2TOUSchedule(TOUConfig TOUConfigTable, CalendarConfig CalendarConfigTable)
        {
            Int16Collection NormalDays;
            Int16Collection HolidayDays;
            ANSITOUSchedule TOUSchedule = new ANSITOUSchedule();

            TOUConfig.TOU_Season CurrentSeason;
            int iNextEventCounter = 0;
            int iPatternID        = 0;

            try
            {
                // First set up the typical week so that we know which day corresponds to which daytype
                if (TOUConfigTable.NumberOfSupportedSeasons > 0)
                {
                    CurrentSeason = TOUConfigTable.Seasons[0];

                    // We have to assume that the Typical week is that same for all seasons. NOTE: The Day to Daytype is 1 based
                    // so we need to subtract 1
                    TOUSchedule.TypicalWeek[(int)eTypicalDay.SUNDAY]    = TOUSchedule.NormalDays[CurrentSeason.TypicalSunday];
                    TOUSchedule.TypicalWeek[(int)eTypicalDay.MONDAY]    = TOUSchedule.NormalDays[CurrentSeason.TypicalMonday];
                    TOUSchedule.TypicalWeek[(int)eTypicalDay.TUESDAY]   = TOUSchedule.NormalDays[CurrentSeason.TypicalTuesday];
                    TOUSchedule.TypicalWeek[(int)eTypicalDay.WEDNESDAY] = TOUSchedule.NormalDays[CurrentSeason.TypicalWednesday];
                    TOUSchedule.TypicalWeek[(int)eTypicalDay.THURSDAY]  = TOUSchedule.NormalDays[CurrentSeason.TypicalThursday];
                    TOUSchedule.TypicalWeek[(int)eTypicalDay.FRIDAY]    = TOUSchedule.NormalDays[CurrentSeason.TypicalFriday];
                    TOUSchedule.TypicalWeek[(int)eTypicalDay.SATURDAY]  = TOUSchedule.NormalDays[CurrentSeason.TypicalSaturday];
                }

                for (int iSeasonCounter = 0; iSeasonCounter < TOUConfigTable.NumberOfSupportedSeasons; iSeasonCounter++)
                {
                    // Get the Season that we are dealing with.
                    CurrentSeason = TOUConfigTable.Seasons[iSeasonCounter];
                    NormalDays    = new Int16Collection();
                    HolidayDays   = new Int16Collection();

                    for (int iDayTypeCounter = 0; iDayTypeCounter < TOUConfigTable.DayTypesPerSeason; iDayTypeCounter++)
                    {
                        CSwitchPointCollection SPColl = new CSwitchPointCollection();
                        for (int iEventCounter = 0; iEventCounter < TOUConfigTable.EventsPerDayType; iEventCounter++)
                        {
                            // Get the Day Event
                            TOUConfig.DayEvent DayEvent = CurrentSeason.TimeOfDayEvents[iDayTypeCounter, iEventCounter];
                            ushort             usEvent  = DayEvent.Event;
                            if (usEvent != (ushort)TOUConfig.DayEvent.TOUEvent.NoMoreChanges)
                            {
                                if (IsRateChangeEvent(usEvent) == true)
                                {
                                    // We have a valid Event, so proceed with createing a SwitchPoint
                                    int iHour      = (int)DayEvent.Hour;
                                    int iMinute    = (int)DayEvent.Minute;
                                    int iStartTime = (iHour * 60) + iMinute;
                                    int iEndTime   = 24 * 60;

                                    iNextEventCounter = iEventCounter + 1;

                                    while (iNextEventCounter < TOUConfigTable.EventsPerDayType)
                                    {
                                        TOUConfig.DayEvent NextDayEvent = CurrentSeason.TimeOfDayEvents[iDayTypeCounter, iNextEventCounter];

                                        if (IsRateChangeEvent(NextDayEvent.Event) == true)
                                        {
                                            iHour    = (int)NextDayEvent.Hour;
                                            iMinute  = (int)NextDayEvent.Minute;
                                            iEndTime = (iHour * 60) + iMinute;

                                            // We need to stop looking once we find the next rate change event.
                                            break;
                                        }

                                        iNextEventCounter++;
                                    }

                                    // Add the rate change event
                                    int iRateIndex = GetRateIndex(usEvent);
                                    // Finally figure out the Switchpoint type
                                    CSwitchPoint SchedSwitchPoint = new CSwitchPoint(iStartTime, iEndTime,
                                                                                     iRateIndex, eSwitchPointType.RATE);

                                    SPColl.Add(SchedSwitchPoint);
                                }
                                else if (IsOutputOnEvent(usEvent) == true)
                                {
                                    // We have a valid output on Event, so proceed with createing a SwitchPoint
                                    int iHour      = (int)DayEvent.Hour;
                                    int iMinute    = (int)DayEvent.Minute;
                                    int iStartTime = (iHour * 60) + iMinute;
                                    int iEndTime   = 24 * 60;

                                    int iOutputIndex = GetOutputIndex(usEvent);

                                    // Find the OutputOff event for this rate if one exists
                                    iNextEventCounter = iEventCounter + 1;

                                    while (iNextEventCounter < TOUConfigTable.EventsPerDayType)
                                    {
                                        TOUConfig.DayEvent NextDayEvent = CurrentSeason.TimeOfDayEvents[iDayTypeCounter, iNextEventCounter];

                                        if (IsOutputOffEvent(NextDayEvent.Event) == true)
                                        {
                                            // Check to see if the index matches
                                            if (iOutputIndex == GetOutputIndex(NextDayEvent.Event))
                                            {
                                                iHour    = (int)NextDayEvent.Hour;
                                                iMinute  = (int)NextDayEvent.Minute;
                                                iEndTime = (iHour * 60) + iMinute;

                                                // We need to stop looking once we find the next rate change event.
                                                break;
                                            }
                                        }

                                        iNextEventCounter++;
                                    }

                                    // Finally figure out the Switchpoint type
                                    CSwitchPoint SchedSwitchPoint = new CSwitchPoint(iStartTime, iEndTime,
                                                                                     iOutputIndex, eSwitchPointType.OUTPUT);

                                    SPColl.Add(SchedSwitchPoint);
                                }

                                // We do not need to handle the OutputOff event since they get handled by the OutputOn check
                            }
                        }

                        // Since we have no way of knowing whether the the patterns for the current season are related
                        // to the patterns in other seasons we need to add the patterns regardless of whether or not it
                        // has already been duplicated in another season

                        // To keep the patterns unique we need to add in an offset for the season number

                        iPatternID = iDayTypeCounter + iSeasonCounter * TOUConfigTable.DayTypesPerSeason;

                        CPattern SchedPattern = new CPattern(iPatternID, "Pattern " + iDayTypeCounter.ToString(CultureInfo.InvariantCulture),
                                                             SPColl);

                        NormalDays.Add((short)iPatternID);

                        // The Day to Daytype conversions are 1's based so subract 1
                        if (iDayTypeCounter == CurrentSeason.TypicalHoliday)
                        {
                            // This Day Type is a holiday
                            HolidayDays.Add((short)iPatternID);
                        }

                        TOUSchedule.Patterns.Add(SchedPattern);
                    }

                    // Add the season to the schedule
                    CSeason SchedSeason = new CSeason(iSeasonCounter + 1, "Season " + (iSeasonCounter + 1).ToString(CultureInfo.InvariantCulture), NormalDays, HolidayDays);

                    TOUSchedule.Seasons.Add(SchedSeason);
                }

                // Now deal with the Calendar part of the config
                TOUSchedule.TOUID = CalendarConfigTable.CalendarID;

                for (int iYearCounter = 0; iYearCounter < CalendarConfigTable.MaxYears; iYearCounter++)
                {
                    CEventCollection EventColl = new CEventCollection();
                    CalendarEvent[]  CalEvents =
                        CalendarConfigTable.Years[iYearCounter].Events;
                    int iYear = 2000 + (int)CalendarConfigTable.Years[iYearCounter].Year;

                    // Start at Index 2, which is the first non-DST Event
                    for (int iDayEvent = CalendarConfigTable.DSTEventsPerYear;
                         iDayEvent < CalendarConfigTable.EventsPerYear; iDayEvent++)
                    {
                        eEventType eType       = CalendarConfigTable.GetEventType(CalEvents[iDayEvent].Type);
                        int        iEventIndex = iDayEvent;

                        if (eEventType.NO_EVENT != eType)
                        {
                            // It is a valid event
                            DateTime dtDate = new DateTime(iYear, CalEvents[iDayEvent].Month + 1,
                                                           CalEvents[iDayEvent].Day + 1);

                            // Determine the index for the event
                            if (eType == eEventType.SEASON)
                            {
                                iEventIndex = CalEvents[iDayEvent].Type - (int)CalendarEvent.CalendarEventType.SEASON1 - 1;
                            }
                            else if (eType == eEventType.HOLIDAY)
                            {
                                // Determine which Holiday day type to use
                                // Currently the ANSI devices only support 1 holiday day type so this is always 0
                                iEventIndex = 0;
                            }

                            CEvent Event = new CEvent(dtDate, eType,
                                                      iEventIndex, "Event " + iDayEvent.ToString(CultureInfo.InvariantCulture));

                            EventColl.Add(Event);
                        }
                    }
                    CYear Year = new CYear(iYear, EventColl);

                    TOUSchedule.Years.Add(Year);

                    // It may be possible that some of the years are not filled in so we need to
                    // make sure that the year is valid by checking to see if the next year is
                    // greater than the current
                    if (iYearCounter + 1 < CalendarConfigTable.MaxYears &&
                        (int)CalendarConfigTable.Years[iYearCounter + 1].Year + 2000 < iYear)
                    {
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                throw (e);
            }

            return(TOUSchedule);
        }
    private void UrlNotFound(CEvent e)
    {
        string url = e.data as string;

        IOSMessage.Create("Url Exists", "The " + url + " wasn't registred");
    }