private static DiskContext.RoleReference CreateRoleReference(RoleReference roleReference) { if (roleReference == null) { return null; } return new DiskContext.RoleReference { DeploymentName = roleReference.DeploymentName, HostedServiceName = roleReference.HostedServiceName, RoleName = roleReference.RoleName }; }
/// <summary> /// Waits until all of the role instances are running in a deployment before releasing /// </summary> /// <returns></returns> IServiceCompleteActivity IRoleReference.WaitUntilAllRoleInstancesAreRunning() { IRoleReference roleReference = new RoleReference(this); return(roleReference.WaitUntilAllRoleInstancesAreRunning()); }
/// <summary> /// Replaces a configuration with a new .cscfg configuration /// </summary> IRoleReference IRoleReference.ReplaceConfiguration(string filename) { IRoleReference roleReference = new RoleReference(this); return(roleReference.ReplaceConfiguration(filename)); }
/// <summary> /// Defines additional roles that the operation should be done on /// </summary> IRoleActivity IRoleReference.AndRole(string name) { IRoleReference roleReference = new RoleReference(this); return(roleReference.AndRole(name)); }
private IEnumerator LoadFromJson(string filePath) { if (!File.Exists(filePath)) { yield break; } StreamReader sr = File.OpenText(filePath); string json = sr.ReadToEnd(); sr.Close(); List <TemplateMapObjectConfig> objsRead = JsonMapper.ToObject <List <TemplateMapObjectConfig> >(json); if (objsRead == null) { yield break; } for (int i = 0; i < objsRead.Count; i++) { yield return(null);//每一个都延迟一帧执行,以免加载角色出错 MPObject mapObj = null; Vector3 positon = objsRead[i].pos.GetVector3(); Vector3 direction = objsRead[i].dir.GetVector3(); if (objsRead[i].objType != "Object") { mapObj = new MPRole(); } else { mapObj = new MPItem(); } mapObj.refid = objsRead[i].refId; mapObj.ObjectType = objsRead[i].objType; RoleReference reference = Global.role_mgr.GetReference(mapObj.refid); if (reference == null) { Debug.LogError(string.Format("无此role表Id:{0}", mapObj.refid)); } else { mapObj.apprId = reference.Apprid; } mapObj.map = curMap.ID; mapObj.sn = objsRead[i].sn; mapObj.ID = curMap.ID * 10000 + mapObj.sn; mapObjs_[mapObj.sn] = mapObj; mapObj.available = objsRead[i].visible; mapObj.camp = (MPObject.ObjectCamp)objsRead[i].camp; mapObj.IsShowInMiddleMap = objsRead[i].isVisibleInMiddleMap; if (mapObj.ObjectType != "Object") { MPRole mpRole = mapObj as MPRole; mpRole.reference = Global.role_mgr.GetReference(mpRole.refid); mpRole.teamID = objsRead[i].team; mpRole.patrolType = (MPRole.PatrolType)Enum.Parse(typeof(MPRole.PatrolType), objsRead[i].patrolType); foreach (MyVector3 myVec in objsRead[i].patrolPath) { mpRole.routeList.Add(new MPRole.RoutePoint(myVec.GetVector3(), 0)); } mpRole.aiRefid = objsRead[i].aiRefId; } else { MPItem item = mapObj as MPItem; item.reference = Global.role_mgr.GetReference(item.refid); item.teamID = objsRead[i].team; } //if (!Physics.Raycast(new Vector3(positon.x, 10, positon.z), Vector3.down, 200)) //{ // Debug.Log("物体坐标非法 sn:" + mapObj.sn); //} mapObj.CreateGameObject((a) => { mapObj.position = positon; mapObj.direction = direction; }); } }
public RoleReferenceBuilder(string name) { _role = new RoleReference(default);
IServiceCompleteActivity IRoleReference.ReturnWithoutWaitingForRunningRoles() { IRoleReference roleReference = new RoleReference(this); return(roleReference.ReturnWithoutWaitingForRunningRoles()); }