Exemplo n.º 1
0
    public void Init(System.Action<Card> cardPartsPushDown, System.Action cardPartsPushUp)
    {
        SetDeck();

        this.cardPartsPushDown = cardPartsPushDown;
        this.cardPartsPushUp = cardPartsPushUp;
    }
Exemplo n.º 2
0
 public frmAddDrv()
 {
     InitializeComponent();
     this.DiscoveryEnd = this.OnEnd;
     this.OnMessage = this.OnLogMessages;
     this.DiscoveryResult = this.OnResult;
 }
Exemplo n.º 3
0
        public MainPage()
        {
            System.Action action = null;
            this.currentPanoramaItemName = string.Empty;
            this.passwordErrorMessage = string.Empty;
            this.image = string.Empty;
            this.margin12120000 = new Thickness(12.0, 12.0, 0.0, 0.0);
            base.Resources.Add("GlobalAppNameLower", AppSetting.Instance.AppName.ToLowerInvariant());
            this.InitializeComponent();
            if (action == null)
            {
                action = delegate
                {
                    this.NavigateTo("/Pages/DataSynchronizationPage.xaml");
                };
            }

            App.GoToRestoreBackupSdfPage = action;
            TiltEffect.SetIsTiltEnabled(this, true);
            backgroundImageSetter = new System.Action<Stream>(this.setBackgroundImage);
            IsolatedAppSetingsHelper.LoadLastMainPageIndex();
            this.mainPageViewModel = ViewModelLocator.MainPageViewModel;
            base.DataContext = this.mainPageViewModel;
            this.InitializeMenu();
            this.StartApp();
            base.Loaded += new RoutedEventHandler(this.MainPage_Loaded);
            base.BackKeyPress += new System.EventHandler<CancelEventArgs>(this.MainPage_BackKeyPress);
            System.DateTime? lastAccessTime = App.LastAccessTime;
            if (lastAccessTime.HasValue)
            {
                System.TimeSpan span = (System.TimeSpan)(System.DateTime.Now.Date - lastAccessTime.Value.Date);
                this.daysWithoutTally = span.Days;
                this.needShowNotificatioToDoTally = this.daysWithoutTally >= 7;
            }
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.needShowNotificatioToDoTally = true;
            }
            IsolatedAppSetingsHelper.LastMainPageIndexCache = (IsolatedAppSetingsHelper.LastMainPageIndexCache < 0) ? 0 : IsolatedAppSetingsHelper.LastMainPageIndexCache;

            if (UpdatingController.HasSomeThingToDoBeforeGoToMainPage(this))
            {
                IsolatedAppSetingsHelper.LastMainPageIndexCache = 0;
            }

            this.MainPanorama.DefaultItem = this.MainPanorama.Items[IsolatedAppSetingsHelper.LastMainPageIndexCache];
            TextBlock block = new TextBlock
            {
                Text = AppResources.Today.ToLowerInvariant(),
                FontSize = 48.0,
                Margin = new Thickness(0.0, 40.0, 0.0, 0.0)
            };
            this.RecentItemList.Header = block;
            Binding binding = new Binding("FavoritesPageVisibiable")
            {
                Source = AppSetting.Instance
            };
            this.RecentItemList.SetBinding(UIElement.VisibilityProperty, binding);
        }
Exemplo n.º 4
0
        protected PartBase(string name)
        {
            this.Name = name ?? GetType().Name.Replace("Part", string.Empty);
            this.execute = ((i) => { });
            this.canExecute = (() => IsActive);

            this.AutoUpdate(true);
        }
Exemplo n.º 5
0
 Act(Person s, Verb v, Noun o1, Noun o2, Act c, System.Action<Act> R)
     : this()
 {
     //Debug.Assert(Arity(v) == 2 || o2, v.ToString() + " is a ternary verb.");
     subject = s; verb = v; primaryObject = o1; secondaryObject = o2; parent = c; Register = R;
     args = new VerbArguments(this);
     Register(this);
 }
Exemplo n.º 6
0
 public IL2CPPBuilder(string tempFolder, string stagingAreaData, IIl2CppPlatformProvider platformProvider, System.Action<string> modifyOutputBeforeCompile, RuntimeClassRegistry runtimeClassRegistry, bool developmentBuild)
 {
   this.m_TempFolder = tempFolder;
   this.m_StagingAreaData = stagingAreaData;
   this.m_PlatformProvider = platformProvider;
   this.m_ModifyOutputBeforeCompile = modifyOutputBeforeCompile;
   this.m_RuntimeClassRegistry = runtimeClassRegistry;
   this.m_DevelopmentBuild = developmentBuild;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Initialize the network connection
        /// </summary>
		public void Connect(string host, int port, System.Action<bool> onResult = null) {

			this.onResult = onResult;
            client = new TcpClient();
			client.NoDelay = true;
			client.BeginConnect(host, port, new AsyncCallback(this.DoСonnect), client);
            isHead = true;

        }
Exemplo n.º 8
0
 public FlexibleMenu(IFlexibleMenuItemProvider itemProvider, int selectionIndex, FlexibleMenuModifyItemUI modifyItemUi, System.Action<int, object> itemClickedCallback)
 {
   this.m_ItemProvider = itemProvider;
   this.m_ModifyItemUI = modifyItemUi;
   this.m_ItemClickedCallback = itemClickedCallback;
   this.m_SeperatorIndices = this.m_ItemProvider.GetSeperatorIndices();
   this.selectedIndex = selectionIndex;
   this.m_ShowAddNewPresetItem = this.m_ModifyItemUI != null;
 }
 public MyGuiScreenEnterSectorProgress(MyMwcTravelTypeEnum travelType, MyMwcVector3Int targetSectorPosition, Vector3 currentShipPosition, System.Action<MyMwcObjectBuilder_Sector, Vector3> enterSectorSuccessfulAction)
     : base(MyTextsWrapperEnum.EnterSectorInProgressPleaseWait, false)
 {
     m_backgroundFadeColor = MyGuiConstants.SCREEN_BACKGROUND_FADE_BLANK_DARK_PROGRESS_SCREEN;
     m_travelType = travelType;
     m_targetSectorPosition = targetSectorPosition;
     m_currentShipPosition = currentShipPosition;
     m_enterSectorSuccessfulAction = enterSectorSuccessfulAction;
 }
Exemplo n.º 10
0
 public void Initialize(string url, Action<string> onMessage, Action onClose, Action onOpen, Action<string> onError)
 {
     this.SocketId = nextSocketId++;
     this.onMessage = onMessage;
     this.onClose = onClose;
     this.onOpen = onOpen;
     this.onError = onError;
     this.url = url;
 }
Exemplo n.º 11
0
 public RelayCommand(System.Action<object> execute, System.Predicate<object> canExecute)
 {
     if (execute == null)
     {
         throw new System.ArgumentNullException("execute");
     }
     this._execute = execute;
     this._canExecute = canExecute;
 }
Exemplo n.º 12
0
        /// <summary>
        /// Initialize the network connection
        /// </summary>
        //TODO onResult is called in a foreign thread
		public void Connect(string host, int port, System.Action<bool> onResult = null) {
			if (client != null) Close();
			this.onResult = onResult;
			client = new TcpClientDebug(name);
//			client.NoDelay = true;
			//Debug.Log(name + " C: Connect(" + endConnected + ")");
			endConnected = false;
			client.BeginConnect(host, port, new AsyncCallback(this.DoСonnect), client);
            isHead = true;
        }
 public MyGuiScreenLoadCheckpointProgress(MyMwcSectorTypeEnum sessionType, MyMwcSessionStateEnum sessionStartType, int? userId, MyMwcVector3Int? position, string checkpointName, System.Action<MyMwcObjectBuilder_Checkpoint> enterSectorSuccessfulAction)
     : base(MyTextsWrapperEnum.EnterSectorInProgressPleaseWait, false, TimeSpan.FromSeconds(360)) // Some missions loads very long (Roch's junkyard)
 {
     m_backgroundFadeColor = MyGuiConstants.SCREEN_BACKGROUND_FADE_BLANK_DARK_PROGRESS_SCREEN;
     m_sessionType = sessionType;
     m_sessionStartType = sessionStartType;
     m_userId = userId;
     m_sectorPosition = position;
     m_checkpointName = checkpointName;
     m_loadCheckpointSuccessfulAction = enterSectorSuccessfulAction;
 }
Exemplo n.º 14
0
        public void Initialize(string url, Action<string> onMessage, Action onClose, Action onOpen, Action<string> onError)
        {
            this.SocketId = socketCount;
            socketCount++;

            this.url = url;
            this.messageCallback = onMessage;
            this.closeCallback = onClose;
            this.openCallback = onOpen;
            this.errorCallback = onError;
        }
 public PeopleImporter()
 {
     this.InitializeComponent();
     TiltEffect.SetIsTiltEnabled(this, true);
     this.currentSelector = this.buddies;
     base.Loaded += new RoutedEventHandler(this.PeopleImporter_Loaded);
     System.Action<ApplicationBarIconButton>[] setters = new System.Action<ApplicationBarIconButton>[] { delegate (ApplicationBarIconButton p) {
         p.Text = AppResources.ShowGroups;
     } };
     base.ApplicationBar.GetIconButtonFrom(0).SetPropertyValue(setters).IsEnabled = false;
 }
Exemplo n.º 16
0
        public void Init(string content, System.Action<TopAlertItem> callbackDisappear, float delay = 1f)
		{
			hideDelay = delay;

			tween.delay = 0f;
			tween.SetOnFinished(OnStart);
			tween.PlayForward();
			
			label.color = originColor;
			label.text = content;
			CallbackDisappear = callbackDisappear;
		}
 public MonthSelectorPage()
 {
     this.InitializeComponent();
     this.mbs = new MessageBoxService(this);
     this.viewModel = new DateConfigViewModel();
     base.Loaded += new RoutedEventHandler(this.MonthSelectorPage_Loaded);
     Microsoft.Unsupported.TiltEffect.SetIsTiltEnabled(this, true);
     System.Action<ApplicationBarIconButton>[] setters = new System.Action<ApplicationBarIconButton>[] { delegate (ApplicationBarIconButton p) {
         p.Text = AppResources.Search;
     } };
     base.ApplicationBar.GetIconButtonFrom(0).SetPropertyValue(setters);
 }
 public System.Net.WebClient DownloadStringAsync(Uri uri, System.Action<String> callBack)
 {
     this.downLoadCompletedCallBack = callBack;
     if (!this.WebClient.IsBusy)
     {
         this.WebClient.DownloadStringAsync(uri);
     }
     else
     {
         this.OnWebClientIsBusyEvent(System.EventArgs.Empty);
     }
     return this.WebClient;
 }
 public System.Net.WebClient OpenReadAsync(Uri uri, System.Action<String> callBack)
 {
     this.openReadCompletedCallBack = callBack;
     if (!this.WebClient.IsBusy)
     {
         this.WebClient.OpenReadAsync(uri, null);
     }
     else
     {
         this.OnWebClientIsBusyEvent(System.EventArgs.Empty);
     }
     return this.WebClient;
 }
Exemplo n.º 20
0
    public void AddUpdateFunc(Action<IPlanerLike> newUpdateFunc)
    {
        //Debug.Log("add");
        if (!m_renewedUpdater)
        {

          m_updateFunc = newUpdateFunc;
          m_renewedUpdater = true;
        }
        else
        {
          m_updateFunc += newUpdateFunc;
        }
    }
Exemplo n.º 21
0
        // called from game thread
        public void Authenticate(System.Action<bool> callback, bool silent) {
            if (mAuthState != AuthState.NoAuth) {
                Logger.w("Authenticate() called while an authentication process was active. " + mAuthState);
                mAuthCallback = callback;
                return;
            }

            // make sure the helper GameObject is ready (we use it for the auth callback)
            Logger.d("Making sure PlayGamesHelperObject is ready.");
            PlayGamesHelperObject.CreateObject();
            Logger.d("PlayGamesHelperObject created.");

            mSilentAuth = silent;
            Logger.d("AUTH: starting auth process, silent=" + mSilentAuth);
            RunOnUiThread(() => {
                switch (mGameHelperManager.State) {
                    case GameHelperManager.ConnectionState.Connected:
                        Logger.d("AUTH: already connected! Proceeding to achievement load phase.");
                        mAuthCallback = callback;
                        DoInitialAchievementLoad();
                        break;
                    case GameHelperManager.ConnectionState.Connecting:
                        Logger.d("AUTH: connection in progress; auth now pending.");
                        mAuthCallback = callback;
                        mAuthState = AuthState.AuthPending;
                        // we'll do the right thing in OnSignInSucceeded/Failed
                        break;
                    default:
                        mAuthCallback = callback;
                        if (mSilentAuth) {
                            Logger.d("AUTH: not connected and silent=true, so failing.");
                            mAuthState = AuthState.NoAuth;
                            InvokeAuthCallback(false);
                        } else {
                            Logger.d("AUTH: not connected and silent=false, so starting flow.");
                            mAuthState = AuthState.InProgress;
                            mGameHelperManager.BeginUserInitiatedSignIn();
                            // we'll do the right thing in OnSignInSucceeded/Failed
                        }
                        break;
                }
            });
        }
 public void InjectedAspect_Dependency_ShouldBeCommited()
 {
   MockRepository mockRepository = new MockRepository();
   ITransaction transaction = mockRepository.DynamicMock<ITransaction>(new object[0]);
   using (mockRepository.Record())
   {
     ITransaction mock = transaction;
     if (InjectedAspectTests.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate2 == null)
     {
       // ISSUE: method pointer
       InjectedAspectTests.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate2 = new System.Action<ITransaction>((object) null, __methodptr(\u003CInjectedAspect_Dependency_ShouldBeCommited\u003Eb__1));
     }
     System.Action<ITransaction> action = InjectedAspectTests.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate2;
     RhinoMocksExtensions.Expect<ITransaction>(mock, action).Repeat.Once();
   }
   InjectedAspectTests.FakeService fakeService = new InjectedAspectTests.FakeService();
   fakeService.Transaction = transaction;
   fakeService.Process();
   RhinoMocksExtensions.VerifyAllExpectations((object) transaction);
 }
Exemplo n.º 23
0
    public FKeyBoard(string fontName, System.Action parentUpdate, System.Action<string> getText)
    {
        _getText = getText;

        int asciiStarter = (int)'a';
        for(float y = 0; y > -Futile.screen.halfWidth; y -= 16*3){
            for(float x = -Futile.screen.halfWidth+16*3; x < Futile.screen.halfWidth-16*3; x += 16*3){
                if (asciiStarter > (int)'z')
                    break;
                FLabel c = new FLabel(fontName, ((char)asciiStarter).ToString());
                c.x = x;
                c.y = y;
                c.scale = 3;
                this.AddChild(c);
                asciiStarter++;
            }
        }
        _update = parentUpdate;
        this.Text = "";
    }
Exemplo n.º 24
0
		private void DoСonnect(IAsyncResult ar) {
            try {
                if (client != ar.AsyncState) {
                    Debug.Log(name + " changed");
					((TcpClient)ar.AsyncState).Close();
					if (this.onResult != null) this.onResult.Invoke(false);
                    return;
                }

                // Finish asynchronous connect
                client.EndConnect(ar);
				stream = client.GetStream();
				endConnected = true;

				Log();
				//Debug.Log(string.Format("R/W stream.Timeout: {0}/{1} client.Timeout: {2}/{3} client.Buffer: {4}/{5} ",
				//		this.stream.ReadTimeout, this.stream.WriteTimeout, this.client.ReceiveTimeout, this.client.SendTimeout, this.client.ReceiveBufferSize, this.client.SendBufferSize));
				if (this.onResult != null) this.onResult.Invoke(true);
            } catch(Exception e) {
				if (this.onResult != null) this.onResult.Invoke(false);
                Debug.Log(e);
            }
			this.onResult = null;
        }
Exemplo n.º 25
0
 /// <summary>
 /// 正在初始化
 /// <para>参数为初始化情况回调</para>
 /// <para>回调参数分别为:初始化进度</para>
 /// </summary>
 /// <param name="initializingAction">初始化情况回调</param>
 /// <returns>自身实例对象</returns>
 public ResourcesManager OnInitializing(System.Action <float> initializingAction)
 {
     OnInitializingEvent += initializingAction;
     return(Instance);
 }
Exemplo n.º 26
0
 public abstract void Schedule(System.Action <object> action, object state);
Exemplo n.º 27
0
 public TimerEntry(System.Action <int> callback)
     : this(0, 0, callback)
 {
 }
Exemplo n.º 28
0
 /// <summary>
 /// 资源管理器的初始化
 /// <para>针对提供自定义资源清单文件json数据的加载请求的情况</para>
 /// <para>大多用于资源清单位于服务器的时候</para>
 /// </summary>
 /// <param name="resourceslistJsonFileWebRequest">配置好了的加载资源清单json数据的请求对象</param>
 /// <returns>自身实例对象</returns>
 public ResourcesManager Init(UnityEngine.Networking.UnityWebRequest resourceslistJsonFileWebRequest, System.Action <bool, float, string> initAction = null)
 {
     return(Init(ResourcesLoadingLocation.Resources, resourceslistJsonFileWebRequest, initAction));
 }
Exemplo n.º 29
0
 /// Display the options, and call the optionChooser when done.
 public abstract void RunOptions(Yarn.OptionSet optionSet,
                                 IDictionary <string, string> strings,
                                 System.Action <int> onOptionSelected);
Exemplo n.º 30
0
        /// <summary>
        /// 初始化资源管理器
        /// <para>默认初始化方式,会从参数指示的位置,按照方法<see cref="GetResourceListFilePath"/>返回的路径进行加载。</para>
        /// </summary>
        /// <param name="resourcesLoadingLocation">加载资源的位置</param>
        /// <returns>自身实例对象</returns>
        public ResourcesManager Init(ResourcesLoadingLocation resourcesLoadingLocation = ResourcesLoadingLocation.Resources, System.Action <bool, float, string> initAction = null)
        {
            if (initAction != null)
            {
                Instance.OnInitEvent += initAction;
            }

            if (Instance._isInitializing || _Instance._isInitDone)
            {
                return(Instance);
            }

            Instance._isInitializing  = true;
            Instance._isInitDone      = false;
            Instance._initProgress    = 0;
            Instance._initError       = null;
            _resourcesLoadingLocation = resourcesLoadingLocation;

            NextFrame(() => {
                Instance.StartCoroutine(loadResourcesList(onInitFunc));
            });

            return(Instance);
        }
Exemplo n.º 31
0
    private IEnumerator LoadPlayerTriggerBoxNodes(CathodeFlowgraph flowgraph, GameObject parentTransform, System.Action <int, GameObject> loadModelCallback)
    {
        PreloadedFlowgraphContent content = preloadedPlayerTriggerBoxNodes.FirstOrDefault(o => o.flowraphID == flowgraph.nodeID);

        for (int i = 0; i < content.nodeNames.Count; i++)
        {
            GameObject thisNodeGO = GameObject.CreatePrimitive(PrimitiveType.Cube);
            thisNodeGO.name                    = content.nodeNames[i];
            thisNodeGO.transform.parent        = parentTransform.transform;
            thisNodeGO.transform.localPosition = content.nodeTransforms[i].position;
            thisNodeGO.transform.localRotation = content.nodeTransforms[i].rotation;
            thisNodeGO.transform.localScale    = new Vector3(content.half_dimensions.y, content.half_dimensions.z, content.half_dimensions.x) * 2; //i dont think this is right
        }
        yield break;
    }
Exemplo n.º 32
0
		public Ack (int packetId, System.Action<string> action)
		{
			this.packetId = packetId;
			this.time = DateTime.Now;
			this.action = action;
		}
Exemplo n.º 33
0
        IEnumerator startThreadHandleResourcePackage(string jsonContent, System.Action <bool, float, string> action)
        {
            var    text     = jsonContent;
            bool   isdone   = false;
            var    progress = 0f;
            string error    = null;

            var _Thread = new System.Threading.Thread(() =>
            {
                try
                {
                    var r = JsonUtility.FromJson <AssetBundleManifest>(text);
                    if (r != null)
                    {
                        _AssetBundleManifest = r;
                        progress             = 0.5f;
                    }
                    else
                    {
                        progress = 1;
                        error    = KSwordKitName + ": 资源清单解析失败!请检查资源清单 json 格式是否正确。或者可以重新生成资源包。(点击:KSwordKit/资源管理/生成资源包)";
                        isdone   = true;
                    }
                }
                catch (System.Exception e)
                {
                    error    = KSwordKitName + ": " + e.Message;
                    progress = 1;
                    isdone   = true;
                }

                if (Instance.ResourcePackage != null)
                {
                    var dc   = Instance.ResourcePackage.AssetBundleInfos.Count;
                    float cc = 0;
                    Instance.ResourcePackage.AssetBundleInfos.ForEach((rm) =>
                    {
                        Instance.AssetbundleName_AssetBundlePathDic[rm.AssetBundleName] = rm;
                        rm.ResourceObjects.ForEach((ro) =>
                        {
                            Instance.ResourceObjectPath_ResourceObjectDic[ro.ResourcePath] = ro;
                        });
                        cc++;
                        progress = 0.5f + 0.5f * cc / dc;
                    });
                    isdone = true;
                }
            });

            _Thread.Start();

            var p = 0f;

            while (!isdone)
            {
                p = progress;
                action(false, progress, null);
                yield return(null);
            }
            if (p != 1)
            {
                action(false, 1, null);
                yield return(null);
            }
            action(true, 1, error);
        }
 private void InitializeAppBar()
 {
     System.Action<ApplicationBarIconButton>[] setters = new System.Action<ApplicationBarIconButton>[] { delegate (ApplicationBarIconButton p) {
         p.Text = AppResources.Edit;
     } };
     base.ApplicationBar.GetIconButtonFrom(0).SetPropertyValue(setters).Click += new System.EventHandler(this.CategoryInfoViewer_EditButton_Click);
     if ((this.current != null) && !this.current.IsParent)
     {
         ApplicationBarIconButton button = new ApplicationBarIconButton
         {
             IconUri = new Uri("/icons/appbar.transfering.rest.png", UriKind.RelativeOrAbsolute),
             Text = AppResources.MoveTo
         };
         button.Click += new System.EventHandler(this.MoveCategoryToButton_Click);
         this.DetectFarvour();
         base.ApplicationBar.Buttons.Add(button);
     }
 }
Exemplo n.º 35
0
 /// <summary>
 /// 资源管理器的初始化
 /// <para>针对可以直接提供资源清单文本内容的情况</para>
 /// </summary>
 /// <param name="resourceslist_jsonString">资源清单的文本内容</param>
 /// <returns>自身实例对象</returns>
 public ResourcesManager Init(string resourceslist_jsonString, System.Action <bool, float, string> initAction = null)
 {
     return(Init(ResourcesLoadingLocation.Resources, resourceslist_jsonString, initAction));
 }
Exemplo n.º 36
0
 public virtual void Authenticate(System.Action <bool> callback, bool silent)
 {
     throw new NotSupportedException("unsupported");
 }
Exemplo n.º 37
0
        /// <summary>
        /// 资源管理器的初始化
        /// <para>针对提供自定义资源清单文件json数据的加载请求的情况</para>
        /// <para>大多用于资源清单位于服务器的时候</para>
        /// </summary>
        /// <param name="resourcesLoadingLocation">资源加载位置</param>
        /// <param name="resourceslistJsonFileWebRequest">配置好了的加载资源清单json数据的请求对象</param>
        /// <returns>自身实例对象</returns>
        public ResourcesManager Init(ResourcesLoadingLocation resourcesLoadingLocation, UnityEngine.Networking.UnityWebRequest resourceslistJsonFileWebRequest, System.Action <bool, float, string> initAction = null)
        {
            if (initAction != null)
            {
                Instance.OnInitEvent += initAction;
            }

            if (Instance._isInitializing || _Instance._isInitDone)
            {
                return(Instance);
            }

            Instance._isInitializing  = true;
            Instance._isInitDone      = false;
            Instance._initProgress    = 0;
            Instance._initError       = null;
            _resourcesLoadingLocation = resourcesLoadingLocation;

            NextFrame(() => {
                Instance.StartCoroutine(loadResourcesList(resourceslistJsonFileWebRequest, onInitFunc));
            });

            return(Instance);
        }
Exemplo n.º 38
0
    private IEnumerator RecursiveLoad(CathodeFlowgraph flowgraph, GameObject parentTransform, System.Action <int, GameObject> loadModelCallback)
    {
        for (int i = 0; i < flowgraph.nodes.Count; i++)
        {
            CathodeNodeEntity node     = flowgraph.nodes[i];
            CathodeFlowgraph  nextCall = commandsPAK.GetFlowgraph(node.nodeType);
            if (nextCall == null)
            {
                continue;
            }
            PosAndRot  trans           = GetTransform(ref node);
            GameObject nextFlowgraphGO = new GameObject(nextCall.name);
            nextFlowgraphGO.transform.parent        = parentTransform.transform;
            nextFlowgraphGO.transform.localPosition = trans.position;
            nextFlowgraphGO.transform.localRotation = trans.rotation;
            StartCoroutine(RecursiveLoad(nextCall, nextFlowgraphGO, loadModelCallback));
        }

        StartCoroutine(LoadModelReferenceNodes(flowgraph, parentTransform, loadModelCallback));
        StartCoroutine(LoadPlayerTriggerBoxNodes(flowgraph, parentTransform, loadModelCallback));

        yield break;
    }
Exemplo n.º 39
0
        private void GetDistributedObjectReference(DistributedObjectId requestedDistributedObjectId, System.Action <IClientDistributedObject> retrieveDistributedObjectCallback)
        {
            IClientDistributedObject clientDistributedObject = this.GetObject(requestedDistributedObjectId) as IClientDistributedObject;

            //if the resulting object is null, we need to cache this request for when the object is eventually downloaded
            if (clientDistributedObject == null)
            {
                if (!mAnticipatedDistributedObjectIdsToCallbacks.ContainsKey(requestedDistributedObjectId))
                {
                    mAnticipatedDistributedObjectIdsToCallbacks.Add(requestedDistributedObjectId, new List <System.Action <IClientDistributedObject> >());
                }
                mAnticipatedDistributedObjectIdsToCallbacks[requestedDistributedObjectId].Add(retrieveDistributedObjectCallback);
            }
            else
            {
                retrieveDistributedObjectCallback(clientDistributedObject);
            }
        }
Exemplo n.º 40
0
 /// <summary>
 /// 初始化失败了
 /// <para>当初始化失败时,会回调<paramref name="initializationFailed"/></para>
 /// <para>回调<paramref name="initializationFailed"/> 中的参数为失败信息</para>
 /// </summary>
 public ResourcesManager OnInitializationFailed(System.Action <string> initializationFailed)
 {
     OnInitializationFailedEvent += initializationFailed;
     return(Instance);
 }
Exemplo n.º 41
0
 public int Test33(ref System.Action <int> action)
 {
     Debugger.Log("ref System.Action action");
     return(14);
 }
Exemplo n.º 42
0
        /// <summary>
        /// 异步加载场景
        /// </summary>
        /// <param name="scenePath">场景资源路径</param>
        /// <param name="asyncAction">异步数据回调</param>
        /// <returns></returns>
        public ResourcesManager LoadSceneAsync(string scenePath, Func <string, AsyncOperation> scnenAsyncRequestFunc, System.Action <bool, float, string, SceneInfo> asyncAction)
        {
            ResourcesAsyncLoader <SceneInfo> .ResourcePackage = ResourcePackage;
            ResourcesAsyncLoader <SceneInfo> .LoadSceneAsync(scenePath, _resourcesLoadingLocation, scnenAsyncRequestFunc, (isdone, progress, error, obj) => {
                if (asyncAction != null)
                {
                    asyncAction(isdone, progress, error, obj);
                }
            });

            return(this);
        }
Exemplo n.º 43
0
 public void Draw(System.Action <Vector3, Vector3, Color4> draw)
 {
     root.Draw(draw);
 }
Exemplo n.º 44
0
 public PartBase(string name, System.Action <PartBase> execute, Func <bool> canExecute = null)
     : this(name)
 {
     this.execute    = execute ?? ((i) => { });
     this.canExecute = canExecute ?? (() => IsActive);
 }
Exemplo n.º 45
0
    private IEnumerator LoadModelReferenceNodes(CathodeFlowgraph flowgraph, GameObject parentTransform, System.Action <int, GameObject> loadModelCallback)
    {
        PreloadedFlowgraphContent content = preloadedModelReferenceNodes.FirstOrDefault(o => o.flowraphID == flowgraph.nodeID);

        for (int i = 0; i < content.nodeNames.Count; i++)
        {
            GameObject thisNodeGO = new GameObject(content.nodeNames[i]);
            thisNodeGO.transform.parent        = parentTransform.transform;
            thisNodeGO.transform.localPosition = content.nodeTransforms[i].position;
            thisNodeGO.transform.localRotation = content.nodeTransforms[i].rotation;
            for (int x = 0; x < content.nodeModelIDs[i].Count; x++)
            {
                loadModelCallback(content.nodeModelIDs[i][x], thisNodeGO);
            }
        }
        yield break;
    }
Exemplo n.º 46
0
        private static CodeTypeReference CreateTypeReference(ITypedElement typedElement, System.Action <CodeAttributeDeclaration> attributePersistor, System.Func <ITypedElement, CodeTypeReference, ITransformationContext, CodeTypeReference> getCollectionType, ITransformationContext context)
        {
            if (typedElement == null)
            {
                return(new CodeTypeReference(typeof(void)));
            }
            CodeTypeReference elementType;
            var systemType = typedElement.Type as IPrimitiveType;

            if (systemType != null)
            {
                elementType = new CodeTypeReference(systemType.SystemType);
            }
            else
            {
                var  type = typedElement.Type;
                bool isReference;
                if (type != null)
                {
                    isReference = type is IReferenceType;
                }
                else
                {
                    isReference = typedElement is IReference;
                }
                elementType = CreateReference(typedElement.Type, isReference, context);
            }
            if (typedElement.UpperBound == 1)
            {
                return(elementType);
            }
            else
            {
                if (attributePersistor != null)
                {
                    if (typedElement.LowerBound > 0)
                    {
                        attributePersistor(new CodeAttributeDeclaration(typeof(LowerBoundAttribute).ToTypeReference(), new CodeAttributeArgument(new CodePrimitiveExpression(typedElement.LowerBound))));
                    }
                    if (typedElement.UpperBound > 1)
                    {
                        attributePersistor(new CodeAttributeDeclaration(typeof(UpperBoundAttribute).ToTypeReference(), new CodeAttributeArgument(new CodePrimitiveExpression(typedElement.UpperBound))));
                    }
                }
                if (getCollectionType == null)
                {
                    return(new CodeTypeReference(typeof(IEnumerable <>).Name, elementType));
                }
                else
                {
                    return(getCollectionType(typedElement, elementType, context));
                }
            }
        }
Exemplo n.º 47
0
 public void DefineOnClick(System.Action <int> clickedOn)
 {
     OnClick = clickedOn;
 }
Exemplo n.º 48
0
        /// <summary>
        /// Connect a web socket to a path on the API and start listening
        /// </summary>
        /// <param name="url">The sub url for the web socket, or null for none</param>
        /// <param name="messageCallback">Callback for messages</param>
        /// <param name="connectCallback"Connect callback
        /// <returns>Web socket - dispose of the wrapper to shutdown the socket</returns>
        public WebSocketWrapper ConnectWebSocket(string url, System.Action <string, WebSocketWrapper> messageCallback, System.Action <WebSocketWrapper> connectCallback = null)
        {
            string fullUrl = BaseUrlWebSocket + (url ?? string.Empty);

            return(new WebSocketWrapper(fullUrl, messageCallback, TimeSpan.FromSeconds(30.0), connectCallback));
        }
Exemplo n.º 49
0
        /// <summary>
        /// 加载资源包方法
        /// </summary>
        /// <param name="action">回调动作</param>
        /// <returns>协程</returns>
        public IEnumerator AsyncLoad(System.Action <bool, float, string, AssetBundle> action)
        {
            // 如果该资源已经加载过了,程序返回该资源的加载情况
            if (asyncloaded)
            {
                if (isDone)
                {
                    action(false, 1, null, null);
                    ResourcesManager.NextFrame(() => action(isDone, 1, error, AssetBundle));
                }
                else
                {
                    LoadingStatusEvent += action;
                }

                yield break;
            }

            // 标记该资源已被加载
            asyncloaded = true;
            // 设置回调函数
            LoadingStatusEvent += action;
            // 先加载依赖
            float dc = Dependencies.Count;
            float cc = 0;

            for (var i = 0; i < dc; i++)
            {
                yield return(ResourcesManager.Instance.AssetbundleName_AssetBundlePathDic[Dependencies[i]].AsyncLoad((isdone, progress, _error, obj) =>
                {
                    if (!string.IsNullOrEmpty(error))
                    {
                        cc++;
                        return;
                    }
                    if (isdone)
                    {
                        error = _error;
                        cc++;
                        return;
                    }
                    LoadingStatusEvent(false, 0.5f * (cc / dc + (1 / dc) * progress), null, null);
                }));
            }
            // 等待所有依赖加载完毕
            while (cc != dc)
            {
                yield return(null);
            }
            // 如果加载依赖过程中发生了错误,则程序终止,返回错误信息。
            if (!string.IsNullOrEmpty(error))
            {
                LoadingStatusEvent(false, 1, error, null);
                yield break;
            }
            // 所有依赖全部顺利加载完毕后,开始加载自身
            var rootDir         = System.IO.Path.Combine(ResourcesManager.Instance.GetResourcesFileRootDirectory(), ResourcesManager.ResourceRootDirectoryName);
            var unityWebRequest = UnityEngine.Networking.UnityWebRequestAssetBundle.GetAssetBundle("file://" + System.IO.Path.Combine(rootDir, AssetBundlePath));

            unityWebRequest.timeout = AsyncLoadTimeout;
            var op = unityWebRequest.SendWebRequest();

            while (!op.isDone)
            {
                isDone = false;
                LoadingStatusEvent(false, 0.5f + 0.5f * op.progress, null, null);
                yield return(null);
            }

            // 加载完成后更新进度信息
            if (op.progress != 1f)
            {
                LoadingStatusEvent(false, 1, null, null);
                yield return(null);
            }
            // 检查加载完成情况
            if (string.IsNullOrEmpty(unityWebRequest.error))
            {
                try
                {
                    // 尝试加载将AssetBundle加载到内存中
                    AssetBundle ab = UnityEngine.Networking.DownloadHandlerAssetBundle.GetContent(unityWebRequest);

                    if (ab != null)
                    {
                        AssetBundle = ab;
                        LoadingStatusEvent(true, 1, null, ab);
                    }
                    else
                    {
                        error = ResourcesManager.KSwordKitName + ": 获取资源包失败!\nassetBunbleName=" + AssetBundleName + "\nAssetBundlePath=" + AssetBundlePath + "\nurl=" + unityWebRequest.url;
                        LoadingStatusEvent(true, 1, error, null);
                    }
                }
                catch (System.Exception e)
                {
                    error = ResourcesManager.KSwordKitName + ": 获取资源包失败!" + e.Message + "\nassetBunbleName=" + AssetBundleName + "\nAssetBundlePath=" + AssetBundlePath + "\nurl=" + unityWebRequest.url;
                    LoadingStatusEvent(true, 1, error, null);
                }
            }
            else
            {
                error = ResourcesManager.KSwordKitName + ": 获取资源包失败!" + unityWebRequest.error + "\nassetBunbleName=" + AssetBundleName + "\nAssetBundlePath=" + AssetBundlePath + "\nurl=" + unityWebRequest.url;
                LoadingStatusEvent(true, 1, error, null);
            }

            LoadingStatusEvent -= action;
            isDone              = true;
        }
Exemplo n.º 50
0
 /// <summary>Stops and cleans up the timer.</summary>
 public void Dispose()
 {
     this.Stop();
     this.Action = (System.Action <int>)null;
 }
Exemplo n.º 51
0
 /// <summary>
 /// Register callback to respond to mouse released events.
 /// </summary>
 public void OnMouseReleased(System.Action <UIElement> callback)
 {
     _onMouseReleasedCallback = callback;
     _ref_onMouseReleased     = _onMouseReleased;
     _BonEngineBind.BON_UIElement_OnMouseReleased(_handle, _ref_onMouseReleased);
 }
Exemplo n.º 52
0
        /// <summary>
        /// 资源管理器的初始化
        /// <para>针对可以直接提供资源清单文本内容的情况</para>
        /// </summary>
        /// <param name="resourcesLoadingLocation">资源加载位置</param>
        /// <param name="resourceslist_jsonString">资源清单的文本内容</param>
        /// <returns>自身实例对象</returns>
        public ResourcesManager Init(ResourcesLoadingLocation resourcesLoadingLocation, string resourceslist_jsonString, System.Action <bool, float, string> initAction = null)
        {
            if (initAction != null)
            {
                Instance.OnInitEvent += initAction;
            }

            if (Instance._isInitializing || _Instance._isInitDone)
            {
                return(Instance);
            }

            Instance._isInitializing = true;
            Instance._isInitDone     = false;
            Instance._initProgress   = 0;
            Instance._initError      = null;

            NextFrame(() => {
                Instance.StartCoroutine(startThreadHandleResourcePackage(resourceslist_jsonString, onInitFunc));
            });
            return(Instance);
        }
Exemplo n.º 53
0
		public Ack(int packetId, System.Action<JSONObject> action)
		{
			this.packetId = packetId;
			this.time = DateTime.Now;
			this.action = action;
		}
Exemplo n.º 54
0
 /// <summary>
 /// Register callback to respond to mouse enter events.
 /// </summary>
 public void OnMouseEnter(System.Action <UIElement> callback)
 {
     _onMouseEnterCallback = callback;
     _ref_onMouseEnter     = _onMouseEnter;
     _BonEngineBind.BON_UIElement_OnMouseEnter(_handle, _ref_onMouseEnter);
 }
 public FFStateMachineStateAction(string name, System.Action<FFStateMachineStateAction, FFStateMachineState, FFStateMachineState> action)
 {
     this.name = name;
     this.action = action;
 }
Exemplo n.º 56
0
 /// <summary>
 /// Register callback to respond to mouse leave events.
 /// </summary>
 public void OnMouseLeave(System.Action <UIElement> callback)
 {
     _onMouseLeaveCallback = callback;
     _ref_onMouseLeave     = _onMouseLeave;
     _BonEngineBind.BON_UIElement_OnMouseLeave(_handle, _ref_onMouseLeave);
 }
        public static void RegisterSelectionMode(TransferingItem transferingItem, System.Action<TransferingItem> afterCreated)
        {
            if (!IsSelectionMode)
            {
                IsSelectionMode = true;
            }

            _transferingItemForScheduledTask = transferingItem;
            AfterCreated = afterCreated;
        }
Exemplo n.º 58
0
 /// <summary>
 /// Register callback to respond to draw events.
 /// </summary>
 public void OnDraw(System.Action <UIElement> callback)
 {
     _onDrawCallback = callback;
     _ref_onDraw     = _onDraw;
     _BonEngineBind.BON_UIElement_OnDraw(_handle, _ref_onDraw);
 }
Exemplo n.º 59
0
    /**
    * Add a listener method to be called when the appropriate LeanTween.dispatchEvent is called
    * @method LeanTween.addListener
    * @param {GameObject} caller:GameObject the gameObject the listener is attached to
    * @param {int} eventId:int a unique int that describes the event (best to use an enum)
    * @param {System.Action<LTEvent>} callback:System.Action<LTEvent> the method to call when the event has been dispatched
    * @example
    * LeanTween.addListener(gameObject, (int)MyEvents.JUMP, jumpUp);<br>
    * <br>
    * void jumpUp( LTEvent e ){ Debug.Log("jump!"); }<br>
    */
    public static void addListener( GameObject caller, int eventId, System.Action<LTEvent> callback )
    {
        if(eventListeners==null){
        INIT_LISTENERS_MAX = LISTENERS_MAX;
        eventListeners = new System.Action<LTEvent>[ EVENTS_MAX * LISTENERS_MAX ];
        goListeners = new GameObject[ EVENTS_MAX * LISTENERS_MAX ];
        }
        // Debug.Log("searching for an empty space for:"+caller + " eventid:"+event);
        for(i = 0; i < INIT_LISTENERS_MAX; i++){
        int point = eventId*INIT_LISTENERS_MAX + i;
        if(goListeners[ point ]==null || eventListeners[ point ]==null){
            eventListeners[ point ] = callback;
            goListeners[ point ] = caller;
            if(i>=eventsMaxSearch)
                eventsMaxSearch = i+1;
            // Debug.Log("adding event for:"+caller.name);

            return;
        }
        if(goListeners[ point ] == caller && System.Object.ReferenceEquals( eventListeners[ point ], callback)){
            // Debug.Log("This event is already being listened for.");
            return;
        }
        }
        Debug.LogError("You ran out of areas to add listeners, consider increasing INIT_LISTENERS_MAX, ex: LeanTween.INIT_LISTENERS_MAX = "+(INIT_LISTENERS_MAX*2));
    }
Exemplo n.º 60
0
 /// <summary>
 /// Register callback to respond to draw events.
 /// </summary>
 public void OnValueChange(System.Action <UIElement> callback)
 {
     _onValueChangeCallback = callback;
     _ref_onValueChange     = _onValueChange;
     _BonEngineBind.BON_UIElement_OnValueChange(_handle, _ref_onValueChange);
 }