Example #1
0
 // Use this for initialization
 void Start()
 {
     //Input should only be accepted locally - the PlayerSync script will handle moving the players across the network
     enabled = GetComponent<NetworkView>().isMine;
     //Assign the components
     ch = GetComponent<CHandler>();
     camh = GetComponentInChildren<CamHandler>();
     gm = GameManager.Instance;
 }
Example #2
0
 // Use this for initialization
 void Start()
 {
     //Input should only be accepted locally - the PlayerSync script will handle moving the players across the network
     enabled = networkView.isMine;
     //Assign the components
     ch   = GetComponent <CHandler>();
     camh = GetComponentInChildren <CamHandler>();
     gm   = GameManager.Instance;
 }
Example #3
0
        internal static void UnRegisterMessage(string _eventStr, CHandler.Handler0 _handler0)
        {
            if (!m_eventDic.ContainsKey(_eventStr))
            {
                return;
            }

            m_eventDic[_eventStr].m_hander0 -= _handler0;
        }
Example #4
0
            public override bool Equals(Either <T1, T2, T3> obj)
            {
                CHandler o = obj as CHandler;

                if (o == null)
                {
                    return(false);
                }
                return(EqualityComparer <T3> .Default.Equals(this.value, o.value));
            }
Example #5
0
            public override bool Equals(object obj)
            {
                CHandler o = obj as CHandler;

                if (o == null)
                {
                    return(false);
                }
                return(Equals(o));
            }
Example #6
0
        internal static void RegisterMessage(string _eventStr, CHandler.Handler3 _handler3)
        {
            if (!m_eventDic.ContainsKey(_eventStr))
            {
                CHandler _handler = new CHandler();
                m_eventDic.Add(_eventStr, _handler);
            }

            m_eventDic[_eventStr].m_hander3 -= _handler3;
            m_eventDic[_eventStr].m_hander3 += _handler3;
        }
Example #7
0
        internal static void RegisterMessage(string _eventStr, CHandler.Handler3 _handler3)
        {
            if (!m_eventDic.ContainsKey(_eventStr))
            {
                CHandler _handler = new CHandler();
                m_eventDic.Add(_eventStr, _handler);
            }

            m_eventDic[_eventStr].m_hander3 -= _handler3;
            m_eventDic[_eventStr].m_hander3 += _handler3;
        }
Example #8
0
        internal static bool SendMessage(string _eventStr, object _obj1, object _obj2, object _obj3)
        {
            if (!m_eventDic.ContainsKey(_eventStr))
            {
                return(false);
            }

            CHandler _handler = m_eventDic[_eventStr];

            if (_handler.m_hander3 != null)
            {
                _handler.m_hander3(_obj1, _obj2, _obj3);

                return(true);
            }

            return(false);
        }
Example #9
0
        internal static bool SendMessage(string _eventStr)
        {
            if (!m_eventDic.ContainsKey(_eventStr))
            {
                return(false);
            }

            CHandler _handler = m_eventDic[_eventStr];

            if (_handler.m_hander0 != null)
            {
                _handler.m_hander0();

                return(true);
            }

            return(false);
        }
Example #10
0
        //55221-b7c0099f2fffc528da4b254b
        public static async void Authentication()
        {
            var        clientHandler = new CHandler();
            HttpClient client        = new HttpClient(clientHandler);

            client.BaseAddress = new Uri("https://getpocket.com/v3/oauth/request");
            var           obj        = new { consumer_key = "55221-b7c0099f2fffc528da4b254b", redirect_uri = "http://localhost:8569" };
            StringContent content    = new StringContent(JsonConvert.SerializeObject(obj), Encoding.UTF8, "application/json");
            var           parameters = new Dictionary <string, string>();

            parameters.Add("consumer_key", "55221-b7c0099f2fffc528da4b254b");
            parameters.Add("redirect_uri", "http://localhost:8569");
            var urlContent = new FormUrlEncodedContent(parameters);
            var response   = await client.PostAsync("", content);

            //response.EnsureSuccessStatusCode();
            var responseText = await response.Content.ReadAsStringAsync();

            Console.WriteLine(responseText);
        }
Example #11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            if (D)
            {
                Log.Info(TAG, "OnCreate");
            }

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.DiagView);
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);

            // Initialize the array adapter for the conversation thread
            mConversationArrayAdapter = new ArrayAdapter <String>(this, Resource.Layout.message);
            mConversationView         = (ListView)FindViewById(Resource.Id.inLv);
            mConversationView.Adapter = mConversationArrayAdapter;
            // Initialize the compose field with a listener for the return key
            mOutEditText = (EditText)FindViewById(Resource.Id.edit_text_out);
            mOutEditText.SetOnEditorActionListener(new TVActionListener(this));
            mSendButton        = (Button)FindViewById(Resource.Id.button_send);
            mSendButton.Click += MSendButton_Click;

            //get intent info
            String info = Intent.GetStringExtra(MainActivity.EXTRA_DEVICE_ADDRESS);
            String name = info.Substring(0, info.Length - 17);

            _Addr           = info.Substring(info.Length - 17);
            ActionBar.Title = name;
            //setup handler
            _Handler   = new CHandler(RefreshUI);
            _CMessager = new Messenger(_Handler);
            //bind service
            _BTServiceConnection = new CServiceConnection(this);
            Intent serviceIntent = new Intent(this, typeof(BluetoothChatService));

            BindService(serviceIntent, _BTServiceConnection, Bind.AutoCreate);
        }
Example #12
0
    public static void AddEventListener <TEvent>(Handler <TEvent> listener) where TEvent : IEvent
    {
        Type eventType = typeof(TEvent);

        if (!Listeners.ContainsKey(eventType))
        {
            Listeners.Add(eventType, new List <KeyValuePair <object, CHandler> >());
        }

        var handlers = GetHandlersByType(eventType);

        if (handlers != null)
        {
            void ListenerCasted666(IEvent x) => listener.Invoke((TEvent)x);

            CHandler handler     = new CHandler(ListenerCasted666);
            var      handlerPair = new KeyValuePair <object, CHandler>(listener, handler);

            handlers.Add(handlerPair);
        }
    }