Beispiel #1
0
        public static IEnumerator GetLimitModel(
            Client client,
            string limitNamespaceName,
            string limitModelName,
            GetLimitModelEvent onGetLimitModel,
            ErrorEvent onError
            )
        {
            AsyncResult <EzGetLimitModelResult> result = null;

            yield return(client.Limit.GetLimitModel(
                             r =>
            {
                result = r;
            },
                             limitNamespaceName,
                             limitModelName
                             ));

            if (result.Error != null)
            {
                onError.Invoke(
                    result.Error
                    );
                yield break;
            }

            var limitModel = result.Result.Item;

            onGetLimitModel.Invoke(limitModelName, limitModel);
        }
Beispiel #2
0
        public IEnumerator Run(
            Client client,
            GameSession session,
            string limitNamespaceName,
            string limitModelName,
            GetLimitModelEvent onGetLimitModel,
            GetCounterEvent onGetCounter,
            CountUpEvent onCountUpEvent,
            ErrorEvent onError
            )
        {
            if (_watching)
            {
                throw new InvalidOperationException("already started");
            }

            _watching = true;

            _client             = client;
            _session            = session;
            _limitNamespaceName = limitNamespaceName;
            _limitModelName     = limitModelName;
            _onGetLimitModel    = onGetLimitModel;
            _onGetCounter       = onGetCounter;
            _onCountUpEvent     = onCountUpEvent;
            _onError            = onError;

            _onCountUpEvent.AddListener(CountUpAction);

            yield return(Refresh());
        }