public static bool IsValidForShow(int type, int id) { bool result = false; EntityData data = new EntityData(); MenuFilterSection menuFilter = MenuFilterSection.GetConfig(); List<GroupMenuFilter> groupFilters = menuFilter.GetGroupMenuFilters(); if (groupFilters.FirstOrDefault(y => y.TargetType == type) != null) { GroupMenuFilter filter = groupFilters.FirstOrDefault(y => y.TargetType == type); EntityDTO dto = data.GetOneEntity(id); if (dto != null) { dto.ExtractProperties(); string category = dto.RenderHTML(filter.PropertyName, RenderOption.None); if (category == filter.PropertyValue) { result = true; } } } else { result = true; } return result; }
public EntityData BuildEntity() { var filter = Body.GetComponent<MeshFilter>(); var sharedMesh = filter.sharedMesh; var sourceMesh = GameObject.Instantiate(sharedMesh); var vertices = sourceMesh.vertices; var angle = Quaternion.AngleAxis(transform.rotation.eulerAngles.y, Vector3.up); for (var i = 0; i < vertices.Length; i++) { var vertex = vertices[i]; vertex.x = vertex.x* Body.transform.lossyScale.x; vertex.y = vertex.y* Body.transform.lossyScale.y; vertex.z = vertex.z* Body.transform.lossyScale.z; vertex = angle * vertex; vertices[i] = vertex; } var points = from vertex in vertices select new Regulus.CustomType.Vector2(vertex.x, vertex.z); var data = new EntityData { Name = Name, Mesh = new Polygon(points.FindHull().ToArray()), CollisionRotation = CollisionRotation }; return data; }
private IrcEvent CmdProcPrivmsgNotice(UserData sender, EntityData target, string text, bool isNotice) { MessageType t = isNotice ? MessageType.Notice : MessageType.Normal; if (text.StartsWith("\u0001") && text.EndsWith("\u0001")) { // CTCP message text = text.Substring(1, text.Length - 2); // cut off control characters if (!isNotice) { // PRIVMSG is CTCP request if (text.StartsWith("ACTION ", StringComparison.InvariantCultureIgnoreCase)) { // Never mind, it's an ACTION (/me) text = text.Substring(7); t = MessageType.Action; // Will fall through to the bottom of the method... } else { if (target is ChannelData) { return new ChannelCtcpEvent((User)sender, (Channel)target, CtcpType.Request, text); } else { return new CtcpEvent((User)sender, (User)target, CtcpType.Request, text); } } } else { // NOTICE is CTCP response return new CtcpEvent((User)sender, (User)target, CtcpType.Response, text); } } if (target is ChannelData) { return new ChannelMessageEvent((User)sender, (Channel)target, t, text); } else { return new UserMessageEvent((User)sender, (User)Entities.Self, t, text); } }
public void EntityData_Properties() { EntityData d = new EntityData() { AssemblyName = "assemblyName", CanBeEdited = true, CanBeIncluded = true, IsIncluded = true, IsEditable = true, Name = "name" }; Assert.AreEqual("name", d.Name, "Name failed"); Assert.AreEqual("assemblyName", d.AssemblyName, "AssemblyName failed"); Assert.IsTrue(d.CanBeIncluded, "CanBeIncluded failed"); Assert.IsTrue(d.CanBeEdited, "CanBeEdited failed"); Assert.IsTrue(d.IsIncluded, "IsIncluded failed"); Assert.IsTrue(d.IsEditable, "IsEditable failed"); // Flip each and verify it can also go false d.CanBeIncluded = false; Assert.IsFalse(d.CanBeIncluded, "CanBeIncluded did not flip"); d.CanBeEdited = false; Assert.IsFalse(d.CanBeEdited, "CanBeEditied did not flip"); d.IsIncluded = false; Assert.IsFalse(d.IsIncluded, "IsIncluded did not flip"); d.IsEditable = false; Assert.IsFalse(d.IsEditable, "IsEditable did not flip"); }
private IrcEvent ParseJoin(UserData sender, EntityData target, string[] param, string text) { if (sender.isclient) { // Client joined new channel - requesting more info immediately WriteOut("MODE " + param[0]); } Entities.Join((ChannelData)target, sender); // Join user and channel before exporting return new JoinEvent((User)sender, (Channel)target); }
public GameObject AddEntity(Vector3 pos, EntityE ent_type, int x, int z) { GameObject new_ent; editorEntityS new_ent_s; print ("ENTITY created @ " + x + ", " + z); if(entity_db.ContainsKey(x)) { if(entity_db[x].ContainsKey(z)) { //if there is already an entity there and we want to overwrite, overwrite it if(entity_db[x][z].getEntityType() != editorUserS.last_created_entity_type) { new_ent = InstantiateEntity(pos, ent_type, x, z); new_ent_s = new_ent.GetComponent<editorEntityS>(); setEntityProperties(new_ent_s); //now delete what is already there Destroy(entity_db[x][z].getEntity()); entity_db[x][z]= new EntityData(new_ent_s.name, new_ent, ent_type, x, z); print ("--replacing : " + entity_db[x][z].getEntityType().ToString() + " with " + ent_type); } else { print ("--same Entity already exists there."); } } else { //we've just gotta make a new z entry since nothing has ever been made in this z spot print ("--nothing ever in that z."); new_ent = InstantiateEntity(pos, ent_type, x, z); new_ent_s = new_ent.GetComponent<editorEntityS>(); setEntityProperties(new_ent_s); entity_db[x].Add(z, new EntityData(new_ent_s.name, new_ent, ent_type, x, z)); } } else { //nothing has ever been made in this x row, so make the z dict and the z entry print ("--nothing ever in that x."); new_ent = InstantiateEntity(pos, ent_type, x, z); new_ent_s = new_ent.GetComponent<editorEntityS>(); setEntityProperties(new_ent_s); entity_db.Add(x, new Dictionary<int, EntityData>()); entity_db[x].Add(z, new EntityData(new_ent_s.name, new_ent, ent_type, x, z)); } return entity_db[x][z].getEntity(); }
private IrcEvent ParseKick(UserData sender, EntityData target, string[] param, string text) { var target_u = Entities.GetUser(param[1]); // Export before deleting data var ev = new KickEvent((User)sender, (Channel)target, (User)target_u, text); if (target_u.isclient) Entities.DropChannel((ChannelData)target); else Entities.Unjoin((ChannelData)target, target_u); return ev; }
private IrcEvent ParseMode(UserData sender, EntityData target, string[] param, string text) { if (target is ChannelData) { // Must rebuild mode string from params string mode = ""; for (int i = 1; i < param.Length; i++) { mode += " " + param[i]; } if (mode.Length > 0) ((ChannelData)target).ModeSet(mode.Substring(1)); // Mode has already been applied when exported return new ChannelModeEvent((User)sender, (Channel)target, param[1]); } else { return new ServerModeEvent((User)target, text); } }
//------------------------------------------------------------------------------- // public void ChangeFonts(EntityData[] data) { if (data == null) { return; } //if (_entityList != null) { _entityList.Clear(); } //_entityList = GetEntitiesByRegex(); _entities = data; // 青くなることがあるので全体をまず黒色に SelectAll(); this.SelectionColor = this.ForeColor; foreach (var item in data) { this.Select(item.range.Start, item.range.Length); this.SelectionFont = (item.type.HasValue) ? _entityFont : _urlFont; this.SelectionColor = Color.Blue; } }
/// ========================= /// INIT /// <summary> /// Initializes properties of EntityDebug /// </summary> /// ========================= private void Init() { // Disable drawing of Debug draw = false; OutOfCamView = true; // obtain Entitie's Transform entTransform = this.gameObject.transform; // Obtain Instance of MainCamera MainCamera = GameObject.Find ("Main Camera").GetComponent<Camera>(); // Obtain Camera Transform CameraTransform = MainCamera.transform; // obtain Entity Data eData = this.gameObject.GetComponent<EntityData>(); // check if Entity Data was not found if(!eData) Debug.LogError ("Assign an Entity Data Component to " + this.gameObject.name); }
public object Clone() { var data = new EntityData { Name = Name, Strength = Strength, Dexterity = Dexterity, Cunning = Cunning, Willpower = Willpower, Magic = Magic, Constitution = Constitution, HealthFormula = HealthFormula, MagicFormula = MagicFormula }; return data; }
protected void Init() { inited = true; //use raged array due to possible uneven counts. entities = new EntityData[entityPrefabs.Length][]; for (int i = 0; i < entityPrefabs.Length; i++) { entities[i] = new EntityData[entityCounts[i]]; for (int j = 0; j < entityCounts[i]; j++) { entities[i][j].active = false; entities[i][j].entity = Instantiate(entityPrefabs[i]); entities[i][j].entity.transform.position = INIT_OBJECT_SPAWN; entities[i][j].entity.gameObject.SetActive(false); entities[i][j].callback = null; } } }
public ProcessStrategy2() { entityData = new EntityData(); }
public void UpdateEntity(EntityData entity) { Database.Instance.UpdateEntity(entity); }
public static void OverrideEntityData <T>(EntityData data) { EntityDataOverrides.AddOrThrow(typeof(T), data, "{0} is already overriden"); }
/** * Fires an update entity event. This is triggered as a result of an *incoming* LVC update * event triggered by an LVC Game external to this one, meaning that the equivalent Unity game * object should be updated. For example, update the tank inside Unity to which represents the * remote VBS2 owned/controlled tank. * * @param data data associated with the event * @return true if the event was handled successfully */ public bool UpdateEntity( ref EntityData data ) { lock( pendingExternalUpdateLock ) { // Debug.Log("External UPDATE event received."); // add the data as a pending external update. Since this event arrived "outside" // Unity's event/threading system, this will eventually be handled by the LVCHelper // Monobehaviour during an Update() event. pendingExternalUpdates.Add( data ); } return true; }
private IrcEvent ParseQuit(UserData sender, EntityData target, string[] param, string text) { // Export before deleting data var ev = new QuitEvent((User)sender, text); Entities.DropUser(sender); return ev; }
public AtomEntryParser(IEntityStore entityStore, EntityData entityConfiguration, APContext context) { _entityStore = entityStore; _entityConfiguration = entityConfiguration; _context = context; }
public void Register( ref EntityData entityData, GameObject gameObject ) { lock( internalEntityRegistryLock ) { if( !internalEntityRegistry.ContainsKey(entityData.id.instance) ) { internalEntityRegistry.Add( entityData.id.instance, gameObject ); lvcClient.CreateEntity( ref entityData ); } } }
/*private void InitializeInputStructs() * { * //Gets the length of the InputType enum * int length = Enum.GetValues(typeof(InputType)).Length; * * //Makes an array long enough to hold all elements of InputType enum * action = new InputAction[length]; * * //Loops through each element in the "actions" array * for (int i = 0; i < action.Length; i++) * { * //For each element, initialize the struct by using the default constructor. We cast the current index value to the type of the enum. * action[i] = new InputAction((InputType)i); * } * }*/ public void LoadFrameData(EntityData newData) { data = newData; LoadFrameData(); }
private void LoadData() { string projectCode = Request["ProjectCode"] + ""; string contractCode = Request["ContractCode"] + ""; string contractChangeCode = Request["ContractChangeCode"] + ""; //try //{ EntityData entity = DAL.EntityDAO.ContractDAO.GetStandard_ContractByCode(contractCode); int status = -2; if (entity.HasRecord()) { // 合同基本信息 entity.SetCurrentTable("Contract"); lblProjectName.Text = BLL.ProjectRule.GetProjectName(projectCode); lblContractID.Text = entity.GetString("ContractID"); lblContractName.Text = entity.GetString("ContractName"); lblSupplierName.Text = BLL.ProjectRule.GetSupplierName(entity.GetString("SupplierCode")); // 显示合同金额 ShowContractMoney(entity, contractChangeCode); //合同变更基本信息 entity.SetCurrentTable("ContractChange"); foreach (DataRow dr in entity.CurrentTable.Select(String.Format("ContractChangeCode='{0}'", contractChangeCode))) { lblVoucher.Text = dr["Voucher"].ToString(); lblChangeId.Text = dr["ContractChangeId"].ToString(); lblChangeReason.Text = dr["ChangeReason"].ToString(); txtSupplierChangeMoney.Value = dr["SupplierChangeMoney"].ToString(); txtConsultantAuditMoney.Value = dr["ConsultantAuditMoney"].ToString(); txtProjectAuditMoney.Value = dr["ProjectAuditMoney"].ToString(); lblChangeType.Text = dr["ChangeType"].ToString(); } //款项明细 entity.SetCurrentTable("ContractCostChange"); dgCostListBind(entity.CurrentTable, contractChangeCode); foreach (DataRow dr in entity.Tables["ContractChange"].Select(string.Format("ContractChangeCode={0}", contractChangeCode), "", System.Data.DataViewRowState.CurrentRows)) { status = (int)dr["Status"]; } this.btnCheck.Visible = false; this.btnDelete.Visible = false; this.btnModify.Visible = false; this.btnOldCheck.Visible = false; this.btnCheckDelete.Visible = false; if (ConfigurationSettings.AppSettings["IsXinChangNin"] != null && ConfigurationSettings.AppSettings["IsXinChangNin"].ToString() == "1") { this.btnPrint.Visible = true; } else { this.btnPrint.Visible = false; } switch (status) { case 0: // 已审 //this.btnCheckDelete.Visible = true; break; case 1: // 申请 this.btnCheck.Visible = true; this.btnDelete.Visible = true; this.btnModify.Visible = true; this.btnOldCheck.Visible = true; break; case 2: // 申请流程中 break; case -1: // 作废 break; } this.gvNexusBind(entity.Tables["ContractNexus"]); entity.Dispose(); } //} //catch (Exception ex) //{ // ApplicationLog.WriteLog(this.ToString(), ex, "加载合同变更数据失败。"); // Response.Write(Rms.Web.JavaScript.Alert(true, "加载合同变更数据失败:" + ex.Message)); //} }
/// <summary> /// 从数据库中删除实体 /// </summary> /// <param name="entity">待删除私信实体</param> /// <param name="userId">私信会话拥有者</param> /// <param name="sessionId">私信会话Id</param> /// <returns>操作后影响行数</returns> public int Delete(Message entity, long sessionId) { var sql = Sql.Builder; IList <Sql> sqls = new List <Sql>(); int affectCount = 0; PetaPocoDatabase dao = CreateDAO(); dao.OpenSharedConnection(); List <string> dd = new List <string>(); sql.From("tn_MessageSessions") .Where("(UserId = @0 and OtherUserId = @1) or (UserId = @1 and OtherUserId = @0)", entity.SenderUserId, entity.ReceiverUserId); List <MessageSession> sessions = dao.Fetch <MessageSession>(sql); if (sessions.Count > 0) { //处理相关会话的计数,如果会话中仅当前一条私信则删除会话 foreach (var session in sessions) { if (session.SessionId != sessionId) { continue; } if (session.MessageCount > 1) { sqls.Add(Sql.Builder.Append("update tn_MessageSessions") .Append("set MessageCount = MessageCount - 1") .Where("SessionId = @0", session.SessionId)); } else { sqls.Add(Sql.Builder.Append("delete from tn_MessageSessions where SessionId = @0", session.SessionId)); } //删除会话与私信的关系 sqls.Add(Sql.Builder.Append("delete from tn_MessagesInSessions where SessionId = @0 and MessageId = @1", session.SessionId, entity.MessageId)); } using (var transaction = dao.GetTransaction()) { affectCount = dao.Execute(sqls); if (sessions.Count == 1) { affectCount += base.Delete(entity); } else { foreach (var session in sessions) { EntityData.ForType(typeof(MessageInSession)).RealTimeCacheHelper.IncreaseAreaVersion("SessionId", session.SessionId); } } transaction.Complete(); } } dao.CloseSharedConnection(); #region 更新缓存 //更新私信会话的缓存 var sessionCacheHelper = EntityData.ForType(typeof(MessageSession)).RealTimeCacheHelper; sessionCacheHelper.IncreaseAreaVersion("UserId", entity.SenderUserId); sessionCacheHelper.IncreaseAreaVersion("UserId", entity.ReceiverUserId); sessions.ForEach((n) => { sessionCacheHelper.IncreaseEntityCacheVersion(n.SessionId); }); #endregion 更新缓存 return(affectCount); }
/// <summary> /// 把实体entity添加到数据库 /// </summary> /// <param name="entity">待创建实体</param> /// <returns>实体主键</returns> public override object Insert(Message entity) { var sql = Sql.Builder; IList <Sql> sqls = new List <Sql>(); long senderSessionId = 0, receiverSessionId = 0; MessageSessionRepository messageSessionRepository = new MessageSessionRepository(); PetaPocoDatabase dao = CreateDAO(); dao.OpenSharedConnection(); object id = base.Insert(entity); sql.Append("update tn_MessageSessions") .Append("set LastMessageId = @0,MessageCount = MessageCount + 1,LastModified = @1", id, entity.DateCreated) .Where("UserId = @0", entity.SenderUserId) .Where("OtherUserId = @0", entity.ReceiverUserId); //判断发件人的会话是否存在 if (dao.Execute(sql) == 0) { sql = Sql.Builder; sql.Append(@"insert into tn_MessageSessions(UserId,OtherUserId,LastMessageId,MessageType,MessageCount,LastModified) values (@0,@1,@2,@3,1,@4)", entity.SenderUserId, entity.ReceiverUserId, id, (int)entity.MessageType, entity.DateCreated); dao.Execute(sql); } //获取发件人的会话Id sql = Sql.Builder; sql.Select("SessionId") .From("tn_MessageSessions") .Where("UserId = @0", entity.SenderUserId) .Where("OtherUserId = @0", entity.ReceiverUserId); senderSessionId = dao.FirstOrDefault <long>(sql); //判断收件人的会话是否存在 sql = Sql.Builder; sql.Append("update tn_MessageSessions") .Append("set LastMessageId = @0,MessageCount = MessageCount + 1,UnreadMessageCount = UnreadMessageCount + 1,LastModified = @1", id, entity.DateCreated) .Where("UserId = @0", entity.ReceiverUserId) .Where("OtherUserId = @0", entity.SenderUserId); if (dao.Execute(sql) == 0) { sql = Sql.Builder; sql.Append("insert into tn_MessageSessions(UserId,OtherUserId,LastMessageId,MessageType,MessageCount,UnreadMessageCount,LastModified) values (@0,@1,@2,@3,1,1,@4)", entity.ReceiverUserId, entity.SenderUserId, id, (int)entity.MessageType, entity.DateCreated); dao.Execute(sql); } //获取收件人的会话Id sql = Sql.Builder; sql.Select("SessionId") .From("tn_MessageSessions") .Where("UserId = @0", entity.ReceiverUserId) .Where("OtherUserId = @0", entity.SenderUserId); receiverSessionId = dao.FirstOrDefault <long>(sql); //添加会话与私信的关系 sqls.Add(Sql.Builder.Append("insert into tn_MessagesInSessions (SessionId,MessageId) values (@0,@1)", senderSessionId, id)); sqls.Add(Sql.Builder.Append("insert into tn_MessagesInSessions (SessionId,MessageId) values (@0,@1)", receiverSessionId, id)); dao.Execute(sqls); dao.CloseSharedConnection(); #region 缓存处理 if (RealTimeCacheHelper.EnableCache) { RealTimeCacheHelper.IncreaseAreaVersion("UserId", entity.SenderUserId); RealTimeCacheHelper.IncreaseAreaVersion("UserId", entity.ReceiverUserId); var realTimeCacheHelper = EntityData.ForType(typeof(MessageInSession)).RealTimeCacheHelper; realTimeCacheHelper.IncreaseAreaVersion("SessionId", senderSessionId); realTimeCacheHelper.IncreaseAreaVersion("SessionId", receiverSessionId); realTimeCacheHelper = EntityData.ForType(typeof(MessageSession)).RealTimeCacheHelper; realTimeCacheHelper.IncreaseAreaVersion("UserId", entity.SenderUserId); realTimeCacheHelper.IncreaseAreaVersion("UserId", entity.ReceiverUserId); realTimeCacheHelper.IncreaseEntityCacheVersion(senderSessionId); realTimeCacheHelper.IncreaseEntityCacheVersion(receiverSessionId); string cacheKey = realTimeCacheHelper.GetCacheKeyOfEntity(senderSessionId); MessageSession senderSession = cacheService.Get <MessageSession>(cacheKey); if (senderSession != null) { senderSession.LastMessageId = entity.MessageId; senderSession.LastModified = entity.DateCreated; senderSession.MessageCount++; } cacheKey = realTimeCacheHelper.GetCacheKeyOfEntity(receiverSessionId); MessageSession receiverSession = cacheService.Get <MessageSession>(cacheKey); if (receiverSession != null) { receiverSession.LastMessageId = entity.MessageId; receiverSession.LastModified = entity.DateCreated; receiverSession.MessageCount++; receiverSession.UnreadMessageCount++; } cacheKey = GetCacheKey_UnreadCount(entity.ReceiverUserId); int?count = cacheService.Get(cacheKey) as int?; count = count ?? 0; count++; cacheService.Set(cacheKey, count, CachingExpirationType.SingleObject); } #endregion 缓存处理 return(id); }
public static string SetResourceAccessRange(string code, string classCode, string unitCode, bool isRefreshRight) { string text5; try { string resourceCode = GetResourceCode(code, classCode); bool flag = resourceCode == ""; EntityData entity = null; if (flag) { resourceCode = SystemManageDAO.GetNewSysCode("ResourceCode"); entity = new EntityData("Standard_Resource"); DataRow newRecord = entity.GetNewRecord(); newRecord["ResourceCode"] = resourceCode; newRecord["ClassCode"] = classCode; newRecord["UnitCode"] = unitCode; newRecord["RelationCode"] = code; entity.AddNewRecord(newRecord); } else { entity = ResourceDAO.GetStandard_ResourceByCode(resourceCode); entity.CurrentRow["unitCode"] = unitCode; } if (isRefreshRight) { entity.DeleteAllTableRow("AccessRange"); } EntityData stationByUnitAccess = OBSDAO.GetStationByUnitAccess(unitCode); entity.SetCurrentTable("AccessRange"); foreach (DataRow row2 in stationByUnitAccess.CurrentTable.Rows) { string text2 = row2["RoleCode"].ToString(); string text3 = row2["StationCode"].ToString(); EntityData data3 = SystemManageDAO.GetStandard_RoleByCode(text2); foreach (DataRow row3 in data3.Tables["RoleOperation"].Select(string.Format(" SubString(OperationCode,1,4)='{0}' ", classCode))) { string text4 = (string)row3["OperationCode"]; DataRow row = entity.GetNewRecord(); row["AccessRangeCode"] = SystemManageDAO.GetNewSysCode("AccessRangeCode"); row["ResourceCode"] = resourceCode; row["UnitCode"] = unitCode; row["OperationCode"] = text4; row["AccessRangeType"] = 1; row["RelationCode"] = text3; entity.AddNewRecord(row); } data3.Dispose(); } stationByUnitAccess.Dispose(); ResourceDAO.SubmitAllStandard_Resource(entity); entity.Dispose(); text5 = resourceCode; } catch (Exception exception) { throw exception; } return(text5); }
private void LoadDataGrid() { try { PayoutItemStrategyBuilder sb = new PayoutItemStrategyBuilder("V_PayoutItem"); sb.AddStrategy(new Strategy(PayoutItemStrategyName.ProjectCode, txtProjectCode.Value)); if (this.ParamCostBudgetSetCode != "") { sb.AddStrategy(new Strategy(PayoutItemStrategyName.CostBudgetSetCode, this.ParamCostBudgetSetCode)); } if (this.ParamCostCode != "") { sb.AddStrategy(new Strategy(PayoutItemStrategyName.CostCodeIncludeAllChild, this.ParamCostCode)); } if (this.ParamSubjectCode != "") { sb.AddStrategy(new Strategy(PayoutItemStrategyName.SubjectCodeIncludeAllChild, this.ParamSubjectCode)); } if (this.ParamContractCode != "") { sb.AddStrategy(new Strategy(PayoutItemStrategyName.ContractCode, this.ParamContractCode)); } if (this.ParamPaymentCode != "") { sb.AddStrategy(new Strategy(PayoutItemStrategyName.PaymentCode, this.ParamPaymentCode)); } if (this.ParamIsContract != "") { sb.AddStrategy(new Strategy(PayoutItemStrategyName.IsContract, this.ParamIsContract)); } if ((this.ParamPBSType != "") || (this.ParamPBSCode != "")) { sb.AddStrategy(new Strategy(PayoutItemStrategyName.PBSTypeAndCode, this.ParamPBSType, this.ParamPBSCode)); } if (this.ParamPayoutDateBegin != "" || this.ParamPayoutDateEnd != "") { ArrayList ar = new ArrayList(); ar.Add(this.ParamPayoutDateBegin); ar.Add(this.ParamPayoutDateEnd); sb.AddStrategy(new Strategy(PayoutItemStrategyName.PayoutDateRange, ar)); } //已审 if (BLL.PaymentRule.IsPayoutMoneyIncludeNotCheck == 0) { sb.AddStrategy(new Strategy(PayoutItemStrategyName.Status, "1,2")); } //排序 string sortsql = BLL.GridSort.GetSortSQL(ViewState); if (sortsql == "") { //缺省排序 sb.AddOrder("PayoutDate", true); sb.AddOrder("PayoutCode", true); } string sql = sb.BuildMainQueryString(); if (sortsql != "") { //点列标题排序 sql = sql + " order by " + sortsql; } QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("PayoutItem", sql); qa.Dispose(); string[] arrField = { "PayoutMoney" }; decimal[] arrSum = BLL.MathRule.SumColumn(entity.CurrentTable, arrField); ViewState["SumMoney"] = arrSum[0].ToString("N"); this.dgList.DataSource = entity.CurrentTable; this.dgList.DataBind(); this.GridPagination1.RowsCount = entity.CurrentTable.Rows.Count.ToString(); entity.Dispose(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); Response.Write(Rms.Web.JavaScript.Alert(true, "显示列表出错:" + ex.Message)); } }
/// <summary> /// 初始化参数描述 /// </summary> private void LoadParamDesc() { try { const string Sep = "<span style='width:20px'></span>"; string desc = ""; //预算表 if (this.ParamCostBudgetSetCode != "") { desc += Sep + "预算表:" + BLL.CostBudgetRule.GetCostBudgetSetName(this.ParamCostBudgetSetCode); } //费用项 if (this.ParamCostCode != "") { desc += Sep + "费用项:" + BLL.CBSRule.GetCostName(this.ParamCostCode); } //科目 if (this.ParamSubjectCode != "") { string SubjectSetCode = BLL.ProjectRule.GetSubjectSetCodeByProject(this.txtProjectCode.Value); desc += Sep + "科目:" + BLL.SubjectRule.GetSubjectName(this.ParamSubjectCode, SubjectSetCode); } //合同 if (this.ParamContractCode != "") { EntityData entity = DAL.EntityDAO.ContractDAO.GetContractByCode(ParamContractCode); if (entity.HasRecord()) { desc += Sep + "合同名称:" + entity.GetString("ContractName"); } entity.Dispose(); } //非合同请款单 if (this.ParamPaymentCode != "") { desc += Sep + "非合同请款单:" + ParamPaymentCode; } //非合同 if (this.ParamIsContract == "0") { desc += Sep + "非合同"; } //单位工程 if ((this.ParamPBSType != "") || (this.ParamPBSCode != "")) { desc += Sep + "单位工程:" + BLL.CostBudgetRule.GetPBSName(ParamPBSType, ParamPBSCode); } //付款日期 if ((this.ParamPayoutDateBegin != "") || (this.ParamPayoutDateEnd != "")) { desc += Sep + "付款日期:" + BLL.StringRule.GetDateRangeDesc(this.ParamPayoutDateBegin, this.ParamPayoutDateEnd); } this.lblParamDesc.Text = desc; } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); Response.Write(Rms.Web.JavaScript.Alert(true, "初始化参数描述出错:" + ex.Message)); } }
private IrcEvent ParseNotice(UserData sender, EntityData target, string[] param, string text) { return CmdProcPrivmsgNotice(sender, target, text, true); }
public CustomPointsStrawberry(EntityData data, Vector2 offset) : base(getBaseStrawberry(data), offset, new EntityID(data.Level.Name, data.ID)) { data.Name = getCustomStrawberryName(data); pointsText = data.Attr("text", "").ToUpper(); isGhostBerry = SaveData.Instance.CheckStrawberry(this.ID); }
public MoveBlockBarrier(EntityData data, Vector2 offset) : base(data, offset) { }
public static Entity LoadRight(Level level, LevelData levelData, Vector2 offset, EntityData entityData) => new TriggerSpikesOriginal(entityData, offset, Directions.Right);
public override void UpdateGraphics(EntityData entity) { base.UpdateGraphics(entity); }
public TriggerSpikesOriginal(EntityData data, Vector2 offset, Directions dir) : this(data.Position + offset, GetSize(data, dir), dir, data.Attr("type", "default")) { }
public void RegisterUnityRepresentation( EntityData entityData, GameObject unityRepresentation ) { lock( externalEntityRegistryLock ) { externalEntityRegistry.Add( entityData.id.instance, new LVCPair<LVCGame.EntityData, GameObject>(entityData, unityRepresentation) ); } lock( gameObjectToLvcIdMapLock ) { gameObjectToLvcIdMap.Add( unityRepresentation, entityData.id.instance); } }
protected void btnSave_ServerClick(object sender, System.EventArgs e) { try { //缺省是分摊到整个项目 string alloType = this.txtAlloType.Value; if (alloType == "") { alloType = "P"; } string inputPayoutCodes = Request["PayoutCodes"] + ""; string inputPayoutItemCodes = Request["PayoutItemCodes"] + ""; bool isManual = (this.chkManual.Checked); if (alloType != "P" && isManual) { if (!CheckTotalMoney()) { return; } } decimal dOldTotalMoney = decimal.Parse(this.txtTotalMoney.Value); // 分摊付款单 if (inputPayoutCodes != "") { EntityData payout = null; if (alloType == "P") { foreach (string payoutCode in inputPayoutCodes.Split(new char[] { ',' })) { if (payoutCode == "") { break; } payout = DAL.EntityDAO.PaymentDAO.GetStandard_PayoutByCode(payoutCode); payout.CurrentRow["IsApportioned"] = 1; foreach (DataRow drPayoutItem in payout.Tables["PayoutItem"].Rows) { drPayoutItem["AlloType"] = "P"; drPayoutItem["IsManualAlloc"] = 0; } payout.DeleteAllTableRow("PayoutItemBuilding"); DAL.EntityDAO.PaymentDAO.SubmitAllStandard_Payout(payout); } } else { foreach (string payoutCode in inputPayoutCodes.Split(new char[] { ',' })) { if (payoutCode == "") { break; } payout = DAL.EntityDAO.PaymentDAO.GetStandard_PayoutByCode(payoutCode); payout.DeleteAllTableRow("PayoutItemBuilding"); payout.SetCurrentTable("Payout"); payout.CurrentRow["IsApportioned"] = 1; foreach (DataRow drPayoutItem in payout.Tables["PayoutItem"].Rows) { drPayoutItem["AlloType"] = alloType; if (isManual) { drPayoutItem["IsManualAlloc"] = 1; } else { drPayoutItem["IsManualAlloc"] = 0; } } payout.SetCurrentTable("payoutItemBuilding"); foreach (DataGridItem item in this.dgList.Items) { string sMoney = ((HtmlInputText)item.FindControl("txtMoney")).Value; decimal dMoney = decimal.Zero; if (isManual) { dMoney = decimal.Parse(sMoney); } string buildingName = ((HtmlInputHidden)item.FindControl("txtBuildingName")).Value; string buildingCode = ((HtmlInputHidden)item.FindControl("txtBuildingcode")).Value; foreach (DataRow drPayoutItem in payout.Tables["PayoutItem"].Rows) { string payoutItemCode = BLL.ConvertRule.ToString(drPayoutItem["PayoutItemCode"]); decimal itemMoney = BLL.ConvertRule.ToDecimal(drPayoutItem["PayoutMoney"]); DataRow newRow = payout.GetNewRecord(); newRow["SystemID"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("PayoutItemBuildingCode"); newRow["PayoutCode"] = payoutCode; newRow["PayoutItemCode"] = payoutItemCode; if (alloType == "U") { newRow["PBSUnitCode"] = buildingCode; } else { newRow["BuildingCode"] = buildingCode; } // 如果是手工分摊,计算分摊金额 if (isManual) { newRow["ItemBuildingMoney"] = itemMoney * dMoney / dOldTotalMoney; } payout.AddNewRecord(newRow); } } DAL.EntityDAO.PaymentDAO.SubmitAllStandard_Payout(payout); } } if (payout != null) { payout.Dispose(); } } else { // 分摊付款单明细 string[] arr = inputPayoutItemCodes.Split(",".ToCharArray()); foreach (string inputPayoutItemCode in arr) { EntityData piTemp = DAL.EntityDAO.PaymentDAO.GetPayoutItemByCode(inputPayoutItemCode); string payoutCode = piTemp.GetString("payoutCode"); piTemp.Dispose(); EntityData payout = DAL.EntityDAO.PaymentDAO.GetStandard_PayoutByCode(payoutCode); payout.CurrentRow["IsApportioned"] = 1; // 清除该款项的分摊 foreach (DataRow rrr in payout.Tables["PayoutItemBuilding"].Select(String.Format(" PayoutItemCode='{0}' ", inputPayoutItemCode))) { rrr.Delete(); } foreach (DataRow drPayoutItem in payout.Tables["PayoutItem"].Select(String.Format(" PayoutItemCode='{0}' ", inputPayoutItemCode))) { drPayoutItem["AlloType"] = alloType; if (isManual) { drPayoutItem["IsManualAlloc"] = 1; } else { drPayoutItem["IsManualAlloc"] = 0; } } payout.SetCurrentTable("payoutItemBuilding"); foreach (DataGridItem item in this.dgList.Items) { string sMoney = ((HtmlInputText)item.FindControl("txtMoney")).Value; decimal dMoney = decimal.Zero; if (isManual) { dMoney = decimal.Parse(sMoney); } string buildingName = ((HtmlInputHidden)item.FindControl("txtBuildingName")).Value; string buildingCode = ((HtmlInputHidden)item.FindControl("txtBuildingcode")).Value; DataRow newRow = payout.GetNewRecord(); newRow["SystemID"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("PayoutItemBuildingCode"); newRow["PayoutCode"] = payoutCode; newRow["PayoutItemCode"] = inputPayoutItemCode; if (alloType == "U") { newRow["PBSUnitCode"] = buildingCode; } else { newRow["BuildingCode"] = buildingCode; } // 如果是手工分摊,计算分摊金额 if (isManual) { newRow["ItemBuildingMoney"] = sMoney; } payout.AddNewRecord(newRow); } // // 查看所有的款项是否都分摊过,都分摊过的整个付款单就是已经分摊了的。 // bool isAllApportion = true; // foreach ( DataRow drPayoutItem in payout.Tables["PayoutItem"].Rows) // { // if( drPayoutItem.IsNull("")) // } DAL.EntityDAO.PaymentDAO.SubmitAllStandard_Payout(payout); payout.Dispose(); } } Response.Write(Rms.Web.JavaScript.ScriptStart); Response.Write(Rms.Web.JavaScript.OpenerReload(false)); Response.Write(Rms.Web.JavaScript.WinClose(false)); Response.Write(Rms.Web.JavaScript.ScriptEnd); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); } }
private IrcEvent ParsePart(UserData sender, EntityData target, string[] param, string text) { // Export before deleting data var ev = new PartEvent((User)sender, (Channel)target, text); if (sender.isclient) Entities.DropChannel((ChannelData)target); else Entities.Unjoin((ChannelData)target, sender); return ev; }
private void LoadData() { string payoutCodes = Request["PayoutCodes"] + ""; string payoutItemCodes = Request["PayoutItemCodes"] + ""; try { if (payoutCodes == "" && payoutItemCodes != "") //传入多个付款单明细 { this.txtProjectCode.Value = ""; decimal totalMoney = 0; this.tdPayout.InnerHtml = "付款款项"; this.tdPayoutCodes.InnerHtml = ""; foreach (string payoutItemCode in payoutItemCodes.Split(new char[] { ',' })) { EntityData payoutItem = DAL.EntityDAO.PaymentDAO.GetPayoutItemByCode(payoutItemCode); if (payoutItem.HasRecord()) { string payoutCode = payoutItem.GetString("PayoutCode"); string payoutId = BLL.PaymentRule.GetPayoutID(payoutCode); string paymentItemCode = payoutItem.GetString("PaymentItemCode"); string paymentItemName = ""; EntityData paymentItem = DAL.EntityDAO.PaymentDAO.GetPaymentItemByCode(paymentItemCode); if (paymentItem.HasRecord()) { paymentItemName = paymentItem.GetString("Summary"); } paymentItem.Dispose(); if (this.tdPayoutCodes.InnerHtml != "") { this.tdPayoutCodes.InnerHtml = this.tdPayoutCodes.InnerHtml + ","; } this.tdPayoutCodes.InnerHtml = this.tdPayoutCodes.InnerHtml + payoutId + "->" + paymentItemName; totalMoney = totalMoney + payoutItem.GetDecimal("PayoutMoney"); if (this.txtProjectCode.Value == "") { EntityData payout = DAL.EntityDAO.PaymentDAO.GetPayoutByCode(payoutCode); this.txtProjectCode.Value = payout.GetString("ProjectCode"); payout.Dispose(); } } payoutItem.Dispose(); } //总金额 this.lblTotalMoney.Text = BLL.StringRule.BuildShowNumberString(totalMoney); this.txtTotalMoney.Value = totalMoney.ToString(); //显示原来的分摊方式 string AlloType = ""; string AlloTypeName = ""; bool IsManual = false; DataTable tb = BLL.PaymentRule.GetAllPayoutItemAlloTypeDetail(payoutItemCodes, ref AlloType, ref AlloTypeName, ref IsManual); this.txtAlloType.Value = AlloType; this.lblAllo.Text = AlloTypeName; this.chkManual.Checked = IsManual; if (AlloType == "P") { this.dgList.Visible = false; } else { this.dgList.Visible = true; BindDataGrid(tb); } } else if (payoutCodes != "") //传入多个付款单 { this.tdPayout.InnerHtml = "付款单"; this.tdPayoutCodes.InnerHtml = ""; decimal totalMoney = decimal.Zero; EntityData payout = null; foreach (string payoutCode in payoutCodes.Split(new char[] { ',' })) { payout = DAL.EntityDAO.PaymentDAO.GetPayoutByCode(payoutCode); if (payout.HasRecord()) { string payoutId = payout.GetString("PayoutID"); totalMoney += payout.GetDecimal("Money"); this.txtProjectCode.Value = payout.GetString("ProjectCode"); if (this.tdPayoutCodes.InnerHtml != "") { this.tdPayoutCodes.InnerHtml = this.tdPayoutCodes.InnerHtml + ","; } this.tdPayoutCodes.InnerHtml = this.tdPayoutCodes.InnerHtml + payoutId; } } if (payout != null) { payout.Dispose(); } this.lblTotalMoney.Text = BLL.StringRule.BuildShowNumberString(totalMoney); this.txtTotalMoney.Value = totalMoney.ToString(); } else { Response.Write(Rms.Web.JavaScript.Alert(true, "请选择要分摊的款项 !")); Response.End(); } } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); Response.Write(Rms.Web.JavaScript.Alert(true, ex.Message)); } }
private IrcEvent ParseTopic(UserData sender, EntityData target, string[] param, string text) { // Export before updating data var ev = new TopicEvent((User)sender, (Channel)target, text); var target_c = (ChannelData)target; if (text == "") { target_c.topic = ""; target_c.topic_setter = ""; target_c.topic_settime = null; } else { target_c.topic = text; target_c.topic_setter = sender.nick; target_c.topic_settime = DateTime.Now; } return ev; }
public FancyExitBlock(EntityData data, Vector2 offset) : base(data.Position + offset, data.Width, data.Height, data.Char("tileType", '3')) { tileMap = GenerateTileMap(data.Attr("tileData", "")); Collider = GenerateBetterColliderGrid(tileMap, 8, 8); }
private IrcEvent ParseInvite(UserData sender, EntityData target, string[] param, string text) { return new InviteEvent((User)sender, (User)Entities.Self, text); }
private static string GetEntityKindMessage(EntityKind entityKind, EntityData entityData, char? gender) { var data = entityData == EntityData.Master ? HelpKindMessage.AndIsRarelyCreatedOrModified.NiceToString().ForGenderAndNumber(gender) : HelpKindMessage.AndAreFrequentlyCreatedOrModified.NiceToString().ForGenderAndNumber(gender); switch (entityKind) { case EntityKind.SystemString: return HelpKindMessage.ClassifyOtherEntities.NiceToString() + data + HelpKindMessage.AutomaticallyByTheSystem.NiceToString(); case EntityKind.System: return HelpKindMessage.StoreInformationOnItsOwn.NiceToString() + data + HelpKindMessage.AutomaticallyByTheSystem.NiceToString(); case EntityKind.Relational: return HelpKindMessage.RelateOtherEntities.NiceToString() + data; case EntityKind.String: return HelpKindMessage.ClassifyOtherEntities.NiceToString() + data; case EntityKind.Shared: return HelpKindMessage.StoreInformationSharedByOtherEntities.NiceToString() + data; case EntityKind.Main: return HelpKindMessage.StoreInformationOnItsOwn.NiceToString() + data; case EntityKind.Part: return HelpKindMessage.StorePartOfTheInformationOfAnotherEntity.NiceToString() + data; case EntityKind.SharedPart: return HelpKindMessage.StorePartsOfInformationSharedByDifferentEntities.NiceToString() + data; default: throw new InvalidOperationException("Unexpected {0}".FormatWith(entityKind)); } }
/// <summary> /// Creates a new image /// </summary> /// <param name="imageFileUploadId">The image file upload id.</param> /// <param name="imageEntityData">The image entity data.</param> /// <param name="fileExtension">The file extension.</param> /// <returns> /// The requested data. /// </returns> /// <exception cref="System.NotImplementedException"></exception> public EntityRef CreateImageFromUploadedFile(string imageFileUploadId, EntityData imageEntityData, string fileExtension) { if (string.IsNullOrEmpty(imageFileUploadId)) { throw new ArgumentException(@"The imageFileUploadId is empty.", "imageFileUploadId"); } if (imageEntityData == null) { throw new ArgumentNullException(@"imageEntityData"); } if (string.IsNullOrEmpty(fileExtension)) { throw new ArgumentNullException(@"fileExtension"); } ImageFileType imageFile; string filePath = string.Empty; try { // Create a new image entity #pragma warning disable 618 var entityInfoService = new EntityInfoService( ); #pragma warning restore 618 imageFile = entityInfoService.CreateEntity(imageEntityData).Entity.AsWritable <ImageFileType>( ); var fileManagerService = new FileManagerService( ); FileDetail fileDetails = fileManagerService.GetFileDetails(imageFileUploadId); filePath = fileDetails.FullName; int width; int height; using (Image image = Image.FromFile(fileDetails.FullName)) { width = image.Width; height = image.Height; } string token; using (var source = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { token = FileRepositoryHelper.AddTemporaryFile(source); } imageFile.FileDataHash = token; imageFile.FileExtension = FileHelper.GetFileExtension(filePath); imageFile.ImageWidth = width; imageFile.ImageHeight = height; imageFile.Save( ); } finally { // Delete the underlying temp file if (!string.IsNullOrEmpty(filePath)) { File.Delete(filePath); } } return(imageFile); }
//////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////// LVC Game Related Methods ////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////// /** * Utility method to carry out tasks required for entity creation events * * @param creations the data for the entity creation events */ private void HandleCreations( EntityData[] creations ) { foreach( EntityData entityData in creations ) { string gameType = entityData.id.gameType; // try to obtain the prefab from the asset manager GameObject prefab = AssetManager.GetPrefab( gameType ); GameObject unityRepresentation; if( prefab ) { unityRepresentation = Instantiate( prefab, UnityEngine.Vector3.zero, new Quaternion() ) as GameObject; } else { // fall back on the default prefab, if defined, otherwise just use a cube Debug.LogWarning( "External CREATE of "+ gameType + " - could not find prefab for '"+gameType+"'. Using default."); if( defaultPrefab != null ) unityRepresentation = Instantiate( defaultPrefab, UnityEngine.Vector3.zero, new Quaternion() ) as GameObject; else unityRepresentation = GameObject.CreatePrimitive( PrimitiveType.Cube ); } // add to our tracking of entity data ==> game objects this.lvcUnityAmbassador.RegisterUnityRepresentation( entityData, unityRepresentation ); // make this the parent of the new unity object - keeps things organised. This isn't so // inmportant in standalone gameplay, but when creating the game we can end up with things // piling up in the heirarchy view of the editor, making it difficult to track things. unityRepresentation.transform.parent = gameObject.transform; // update the representation so it's in the right place, pointing in the right direction AssignEntityDataToGameObject( entityData, unityRepresentation ); // If we need to add any extra handlers of entitydata for this entity, we should do it now. // This might be necessary in the case of a tank, where we not only need to position the tank // itself, but also need to update the rotation of its turret - the turret rotation handling // is not handled by the basic update, so an specialised handler would be required. /* if( gameType == LVCGameTypes.EXAMPLE ) { unityRepresentation.AddComponent<ExampleExtraUpdateHandler>(); unityRepresentation.AddComponent<ExampleExtraFireHandler>(); } */ } if( showLogging && creations.Length>0 ) Debug.Log( creations.Length + " External Creation Events Handled." ); }
private IrcEvent ParseNick(UserData sender, EntityData target, string[] param, string text) { // Export before altering data var ev = new NickChangeEvent((User)sender, text); sender.nick = text; return ev; }
public void Copy(EntityData data) { name = data.name; value = data.value; hp = data.hp; energy = data.energy; resource = data.resource; balance = data.balance; range = data.range; attack = data.attack; revenue = data.revenue; speed = data.speed; type = data.type; }
public static async void Receive(NetIncomingMessage message, string type) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Message type: " + type); Console.ResetColor(); switch (type) { case Constants.OUTGAME.GO_PLAYERDISCONNECT: { var userList = GameServer.UsingPeer.Connections .Where(con => con.Tag != null && con.Tag.ToString() == "USER" && con != message.SenderConnection).ToList(); var sendMsg = GameServer.UsingPeer.CreateMessage() .Start(Constants.MESSAGETYPE.OUTGAME); sendMsg.Write(Constants.OUTGAME.EVENT_ON_PLAYERDISCONNECT); sendMsg.Write(message.SenderConnection.GetGameUser().login); GameServer.UsingPeer.SendMessage(sendMsg, userList, NetDeliveryMethod.ReliableOrdered, 0); message.SenderConnection.Disconnect("SUCCESS_DISCONNECT"); break; } // Quelqu'un s'est co sur notre serveur! // Cet event à été trigger côté gameServer par le masterServer, mais il sera redistribué côté clients case Constants.OUTGAME.EVENT_ON_PLAYERCONNECT: { GameServer.MasterConnection = message.SenderConnection; GameUser tempUser = null; tempUser = message.ReadBytes(message.ReadInt32()).Deserialize <GameUser>(); GamePlayer usingPlayer = null; usingPlayer = message.ReadBytes(message.ReadInt32()).Deserialize <GamePlayer>(); var user = UserManager.Take(tempUser.login); user.currConnectionId = tempUser.currConnectionId; user.currentPlayerIndex = 0; user.currentRoom = tempUser.currentRoom; user.currentTeams = tempUser.currentTeams; user.email = tempUser.email; user.guid = tempUser.guid; user.login = tempUser.login; user.nickname = tempUser.nickname; user.ownedPlayers = new Dictionary <int, GamePlayer>() { { 0, usingPlayer } }; GameServer.Log($"User joined! {user.login}"); usingPlayer.User = user; GameServer.gameServer.usersInRoom[user.login] = user; GameServer.gameServer.playersInRoom[user.login] = usingPlayer; GameServer.gameServer.CheckPlayerOrder(); var userList = GameServer.UsingPeer.Connections .Where(con => con.Tag != null && con.Tag.ToString() == "USER").ToList(); if (userList.Count > 0) { var sendMsg = GameServer.UsingPeer.CreateMessage() .Start(Constants.MESSAGETYPE.OUTGAME); sendMsg.Write(Constants.OUTGAME.EVENT_ON_PLAYERCONNECT); sendMsg.Write(usingPlayer); GameServer.UsingPeer.SendMessage(sendMsg, userList, NetDeliveryMethod.ReliableOrdered, 0); } if (GameServer.gameServer.waitedUsers.ContainsKey(user.login)) { GameServer.Log("(Connection) Approving waited connection: " + user.login); GameServer.gameServer.waitedUsers[user.login].Approve(); user.AddNetConnection(GameServer.gameServer.waitedUsers[user.login]); GameServer.gameServer.waitedUsers.Remove(user.login); } if (user.login == GameServer.Room.creatorName) { GameServer.HostUser = user; GameServer.HostPlayer = usingPlayer; GameServer.gameServer.ReplacementEntities.Add(3, 1); } GameServer.gameServer.lastUpdate = -1; break; } case Constants.OUTGAME.EVENT_ON_RECEIVEROOMINFO: { GameServer.Room = new GameRoom(); GameServer.Room.guid = message.ReadString(); GameServer.Room.originalOption = message.ReadBytes(message.ReadInt32()).Deserialize <GameRoomOption>(); GameServer.Room.creatorName = message.ReadString(); GameServer.Room.gameType = (GameType)message.ReadInt32(); Console.WriteLine($@"ROOM INFO RECEIVED! {GameServer.Room.guid} {GameServer.Room.creatorName} {GameServer.Room.gameType}"); break; } case Constants.OUTGAME.EVENT_ON_UPDATEONLINEENTITY: { var userLogin = message.ReadString(); var entityData = message.ReadBytes(message.ReadInt32()).Deserialize <EntityData>(); string debugMessage = Time.TimeElapsed + "Entity update provided by the server!"; await Task.Factory.StartNew(() => { while (!GameServer.gameServer.usersInRoom.ContainsKey(userLogin)) { ; } while (GameServer.gameServer.usersInRoom[userLogin].ownedPlayers.Count == 0) { ; } while (GameServer.gameServer.waitedUsers.ContainsKey(userLogin)) { ; } }); if (GameServer.gameServer.usersInRoom.TryGetValue(userLogin, out var user)) { var player = user.ownedPlayers[0]; EntityData oldEntity = null; if (player.EntitiesInPossession == null) { player.EntitiesInPossession = new List <EntityData>(); } if (player.EntitiesInPossession.Exists(e => (oldEntity = e).ServerID == entityData.ServerID)) { debugMessage += "\tUpdate"; // Update oldEntity.ArmyIndex = entityData.ArmyIndex; oldEntity.ClassesInPossession = entityData.ClassesInPossession; oldEntity.CurrentClass = entityData.CurrentClass; oldEntity.CurrentRarepon = entityData.CurrentRarepon; oldEntity.RareponsInPossession = entityData.RareponsInPossession; oldEntity.SchemeID = entityData.SchemeID; oldEntity.ServerID = entityData.ServerID; oldEntity.Type = entityData.Type; } else { debugMessage += "\tCreation"; // Create player.EntitiesInPossession.Add(entityData); } } debugMessage += $@"Struct: ArmyIndex: {entityData.ArmyIndex} ClassesInPossession Count: {(entityData.ClassesInPossession == null ? 0 : entityData.ClassesInPossession.Count)} CurrentClass: {entityData.CurrentClass} RareponsInPossession Count: {(entityData.RareponsInPossession == null ? 0 : entityData.RareponsInPossession.Count)} CurrentRarepon: {entityData.CurrentRarepon} SchemeID: {entityData.SchemeID} ServerID: {entityData.ServerID} Type: {entityData.Type} "; GameServer.Log(debugMessage); SendNewEntityToAll(userLogin, entityData); await Task.Delay(100); await Task.Factory.StartNew(() => { while (GameServer.GetUserConnections().Count == 0) { ; } }); SendNewArmy(); break; } case Constants.OUTGAME.EVENT_ON_RECEIVEFINALLOADOUT: { var playerLogin = message.ReadString(); GameServer.Log("Receving loadout of " + playerLogin); if (GameServer.gameServer.playersInRoom.ContainsKey(playerLogin)) { var entityList = message.ReadBytes(message.ReadInt32()).Deserialize <EntityData[]>(); PlayerManager.LoadoutOfAll[GameServer.gameServer.playersInRoom[playerLogin]] = entityList.ToList(); } break; } } }
/// **************************************************************************** /// <summary> /// 数据加载 /// </summary> /// **************************************************************************** private void LoadData(bool Flag) { RmsPM.BLL.BiddingFile cBiddingFile = new RmsPM.BLL.BiddingFile(); if (this.ApplicationCode != "") { this.BiddingFileCode = this.ApplicationCode; } else if (this.BiddingFileCode != "") { this.ApplicationCode = this.BiddingFileCode; } //System.Data.DataTable dtBiddingFile = cBiddingFile.GetBiddings(); //if (dtBiddingFile.Rows.Count != 0) //{ // this.BiddingFileCode = dtBiddingFile.Rows[0]["BiddingFileCode"].ToString(); // cBiddingFile.BiddingFileCode = this.BiddingFileCode; if (this.ApplicationCode != "") { EntityData entitydata = RmsPM.BLL.BiddingFile.GetBiddingFileByCode(this.ApplicationCode); if (entitydata.HasRecord()) { this.BiddingFileState = entitydata.GetString("state"); if (Flag) { RmsPM.BLL.Bidding cBidding = new RmsPM.BLL.Bidding(); cBidding.BiddingCode = this.BiddingCode; string LinkUrl = "<a onclick=OpenLargeWindow('../BiddingManage/biddingmodify.aspx?BiddingCode=" + this.BiddingCode + "&State=edit&ProjectCode=" + cBidding.ProjectCode + "','ControlBiddingFileModigy3')>" + cBidding.Title + "</a>"; //this.tdBiddingTitle.InnerHtml = cBidding.Title; this.txtBiddingTitle.InnerHtml = LinkUrl; this.txtProjectName.InnerHtml = RmsPM.BLL.ProjectRule.GetProjectName(cBidding.ProjectCode); this.TxtBiddingFileName.Value = entitydata.GetString("Remark"); this.TxtNumber.Value = entitydata.GetString("BiddingFileNumber"); this.tdBiddingFileState1.InnerHtml = RmsPM.BLL.BiddingFile.GetBiddingFileStatusName(BiddingFileState); } else { RmsPM.BLL.Bidding cBidding = new RmsPM.BLL.Bidding(); cBidding.BiddingCode = this.BiddingCode; string LinkUrl = "<a onclick=OpenLargeWindow('../BiddingManage/biddingmodify.aspx?BiddingCode=" + this.BiddingCode + "&State=edit&ProjectCode=" + cBidding.ProjectCode + "','ControlBiddingFileModigy1')>" + cBidding.Title + "</a>"; //this.tdBiddingTitle.InnerHtml = cBidding.Title; this.tdBiddingTitle.InnerHtml = LinkUrl; this.tdProjectName.InnerHtml = RmsPM.BLL.ProjectRule.GetProjectName(cBidding.ProjectCode); this.TdBiddingFileName.InnerHtml = entitydata.GetString("Remark"); this.TdNumber.InnerHtml = entitydata.GetString("BiddingFileNumber"); this.tdBiddingFileState2.InnerHtml = RmsPM.BLL.BiddingFile.GetBiddingFileStatusName(BiddingFileState); } } entitydata.Dispose(); } else { RmsPM.BLL.Bidding cBidding = new RmsPM.BLL.Bidding(); cBidding.BiddingCode = this.BiddingCode; string LinkUrl = "<a onclick=OpenLargeWindow('../BiddingManage/biddingmodify.aspx?BiddingCode=" + this.BiddingCode + "&State=edit&ProjectCode=" + cBidding.ProjectCode + "','ControlBiddingFileModigy2')> " + cBidding.Title + "</a>"; //this.tdBiddingTitle.InnerHtml = cBidding.Title; this.txtBiddingTitle.InnerHtml = LinkUrl; this.txtProjectName.InnerHtml = RmsPM.BLL.ProjectRule.GetProjectName(cBidding.ProjectCode); } }
public IMetaData getMetaData() { EntityData entity = new EntityData(this.sName, this.type, this.Location.X, this.Location.Y, this.Width, this.Height); return (IMetaData)entity; }
public MultiNodeBumper(EntityData data, Vector2 offset) : base(data.Position + offset, null, data.Bool("notCoreMode", false), data.Bool("wobble", false)) { thisEntityData = data; thisOffset = offset; }
public EntityKindAttribute(EntityKind entityKind, EntityData entityData) { this.EntityKind = entityKind; this.EntityData = entityData; }
public static Entity LoadConditionBlock(Level level, LevelData levelData, Vector2 offset, EntityData entityData) { ConditionBlockModes conditionBlockModes = entityData.Enum("condition", ConditionBlockModes.Key); EntityID conditionEntity = EntityID.None; string[] condition = entityData.Attr("conditionID").Split(':'); conditionEntity.Level = condition[0]; conditionEntity.ID = Convert.ToInt32(condition[1]); if (conditionBlockModes switch { ConditionBlockModes.Key => level.Session.GetFlag(DashSwitch.GetFlagName(conditionEntity)), ConditionBlockModes.Button => level.Session.DoNotLoad.Contains(conditionEntity), ConditionBlockModes.Strawberry => level.Session.Strawberries.Contains(conditionEntity), _ => throw new Exception("Condition type not supported!") })
public static Entity LoadRight(Level level, LevelData levelData, Vector2 offset, EntityData entityData) { entityData.Values["type"] = entityData.Attr("hotType", "default"); return(new CoreModeSpikes(entityData, offset, Directions.Right)); }
//------------------------------------------------------------------------- // 玩家进入桌子 public Task <DesktopData> s2sPlayerEnter(DesktopRequestPlayerEnter request_enter, EntityData etdata_playermirror) { byte seat_index = request_enter.seat_index; if (getPlayerCountInSeat() >= DesktopConfigData.seat_num) { // 没有空座位了,观战 seat_index = 255; } if (!isValidSeatIndex(seat_index)) { // 座位索引范围不合法,重新分配空座位 foreach (var i in AllSeat) { if (i.et_playermirror == null) { seat_index = i.index; break; } } } if (isValidSeatIndex(seat_index) && AllSeat[seat_index].et_playermirror != null) { // 座位上已经有人坐了,重新分配空座位 foreach (var i in AllSeat) { if (i.et_playermirror == null) { seat_index = i.index; break; } } } var et_playermirror = EntityMgr.genEntity <EtPlayerMirror, Entity>(etdata_playermirror, Entity); var co_actormirror = et_playermirror.getComponent <CellActorMirror <DefActorMirror> >(); var co_ai = et_playermirror.getComponent <CellActorMirrorAi <DefActorMirrorAi> >(); byte actorid_indesktop = _genPlayerId(); co_actormirror.Def.PropActorIdInDesktop.set(actorid_indesktop); EbLog.Note("CellDesktop.s2sPlayerEnter() PlayerEtGuid=" + et_playermirror.Guid); MapAllPlayer1[actorid_indesktop] = et_playermirror; MapAllPlayer[et_playermirror.Guid] = et_playermirror; if (isValidSeatIndex(seat_index)) { AllSeat[seat_index].et_playermirror = et_playermirror; } co_actormirror.onEnterDesktop(seat_index); // 更新DesktopInfo refreshDesktopInfo(); // 广播玩家进入桌子 DesktopNotify desktop_notify; desktop_notify.id = DesktopNotifyId.PlayerEnter; desktop_notify.data = EbTool.protobufSerialize <EntityData>(et_playermirror.genEntityData4All()); StreamData sd = new StreamData(); sd.event_id = StreamEventId.DesktopStreamEvent; sd.param1 = desktop_notify; var grain_desktop = Entity.getUserData <GrainCellDesktop>(); grain_desktop.AsyncStream.OnNextAsync(sd); // 通知场景玩家坐下 LogicScene.scenePlayerEnter(actorid_indesktop, 1, "aabb", false, -1, TbDataTurret.TurretType.NormalTurret); float player_rate = 1.0f;// mEtDesktopPumping.getPlayerUpgradeRate();// 抽水率 LogicScene.scenePlayerRateChanged(1, player_rate); DesktopData desktop_data = _getDesktopData(); return(Task.FromResult(desktop_data)); }
private void SpawnEnemy(EntityData entityData, GameTime gameTime) { if (entityData.Type == EntityType.BOSS) { Boss boss = new Boss(spriteBatch, game, audioManager, gameTime, "boss" + enemySpawnCounter.ToString(), this); boss.position = entityData.Position; addEntity(boss); levelManager.stopBgScroll(); } else if (entityData.Type == EntityType.NIGHTMARE) { Nightmare nightmare = new Nightmare(spriteBatch, game, audioManager, this, "nightmare" + enemySpawnCounter.ToString()); nightmare.onDie += new Nightmare.PowerupReleaseHandle(ReleasePowerup); nightmare.position = entityData.Position; addEntity(nightmare); } else if (entityData.Type == EntityType.BLUE_BLOOD_VESSEL) { BlueBloodvessel bloodvessel = new BlueBloodvessel(spriteBatch, game, audioManager, this, "blue_bloodvessel" + enemySpawnCounter.ToString()); bloodvessel.onDie += new BlueBloodvessel.PowerupReleaseHandle(ReleasePowerup); //bloodvessel.position = entityData.Position; addEntity(bloodvessel); } else if (entityData.Type == EntityType.RED_BLOOD_VESSEL) { RedBloodvessel bloodvessel = new RedBloodvessel(spriteBatch, game, audioManager, this, "red_bloodvessel" + enemySpawnCounter.ToString()); //bloodvessel.onDie += new RedBloodvessel.PowerupReleaseHandle(ReleasePowerup); bloodvessel.position = entityData.Position; addEntity(bloodvessel); } else if (entityData.Type == EntityType.PURPLE_BLOOD_VESSEL) { PurpleBloodvessel bloodvessel = new PurpleBloodvessel(spriteBatch, game, audioManager, this, "purple_bloodvessel" + enemySpawnCounter.ToString()); //bloodvessel.onDie += new PurpleBloodvessel.PowerupReleaseHandle(ReleasePowerup); bloodvessel.position = entityData.Position; addEntity(bloodvessel); } else if (entityData.Type == EntityType.DARK_THOUGHT) { DarkThought darkThought = new DarkThought(spriteBatch, game, audioManager, gameTime, "darkthought" + enemySpawnCounter.ToString(), this, entityData.PathFinding); darkThought.onDie += new DarkThought.PowerupReleaseHandle(ReleasePowerup); darkThought.position = entityData.Position; addEntity(darkThought); } else if (entityData.Type == EntityType.INNER_DEMON) { InnerDemon innerDemon = new InnerDemon(spriteBatch, game, audioManager, "inner_demon" + enemySpawnCounter.ToString(), this, entityData.PathFinding); innerDemon.onDie += new InnerDemon.PowerupReleaseHandle(ReleasePowerup); innerDemon.position = entityData.Position; addEntity(innerDemon); } else if (entityData.Type == EntityType.DARK_WHISPER) { DarkWhisper darkWhisper = new DarkWhisper(spriteBatch, game, audioManager, "dark_whisper" + enemySpawnCounter.ToString(), this, entityData.PathFinding); darkWhisper.onDie += new DarkWhisper.PowerupReleaseHandle(ReleasePowerup); darkWhisper.position = entityData.Position; addEntity(darkWhisper); } else if (entityData.Type == EntityType.WEAPON_POWERUP_SPREAD) { WeaponPowerupSpread wpnPowerupSpread = new WeaponPowerupSpread(spriteBatch, game, "wpnPowerupSpread" + enemySpawnCounter.ToString(), entityData.Position); addEntity(wpnPowerupSpread); } else if (entityData.Type == EntityType.WEAPON_POWERUP_RAPID) { WeaponPowerupRapid wpnPowerupRapid = new WeaponPowerupRapid(spriteBatch, game, "wpnPowerupRapid" + enemySpawnCounter.ToString(), entityData.Position); addEntity(wpnPowerupRapid); } else if (entityData.Type == EntityType.HEALTH_POWERUP) { HealthPowerup healthPowerup = new HealthPowerup(spriteBatch, game, "healthPowerup" + enemySpawnCounter.ToString(), entityData.Position); addEntity(healthPowerup); } enemySpawnCounter++; }
public CustomCoreMessage(EntityData data, Vector2 offset) : base(data.Position + offset) { Tag = Tags.HUD; text = Dialog.Clean(data.Attr("dialog", "app_ending")).Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries)[data.Int("line", 0)]; }
//////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////// Utility/Convenience Methods //////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////// /** * A utility function which applies the basic information contained in an LVC Game * EntityData structure to the appropriate properties of a Unity GameObject, such as * position, orientation and so on. * * @param entityData the LVC Game information which should be applied to the Unity game object * @param gameObject the Unity game object to which the LVC Game information should be applied */ private void AssignEntityDataToGameObject( EntityData entityData, GameObject gO ) { // position ---------------------------------------------------------------- // AXIS (+ve): | LVC | UNITY //-------------+-----+------- // NORTH | X | X // EAST | Y | Z // VERTICAL | Z | Y // The x/y values in entityData.physics.position are lat/long in radians 'distance' relative to the map // origin (i.e., not "absolute" lat/long on the surface of the Earth. Likewise the z value is the hieght // relative to the origin in meters. // Find map origin LVCGame.Vector3 worldOriginLLA = LVCUtils.GetLVCWorldOriginLLA(); LVCGame.UTMCoordinate worldOriginUTM = LVCUtils.GetLVCWorldOriginUTM(); // Make an adjusted position to asbolute lat/long, height in radians and meters LVCGame.Vector3 physicsPositionLLA = new LVCGame.Vector3( entityData.physics.position.x + worldOriginLLA.x, entityData.physics.position.y + worldOriginLLA.y, entityData.physics.position.z + worldOriginLLA.z ); // convert absolute lat/long, height to local coordinates on the map using UTM LVCGame.UTMCoordinate physicsPositionUTM = LVCGame.LVCCoordinates.llaToUtm( ref physicsPositionLLA ); UnityEngine.Vector3 unityPosition = new UnityEngine.Vector3( (float)(physicsPositionUTM.easting - worldOriginUTM.easting), (float)(physicsPositionUTM.altitude - worldOriginUTM.altitude), (float)(physicsPositionUTM.northing - worldOriginUTM.northing) ); Quaternion unityOrientation = LVCUtils.LVCGameOrientation_to_UnityOrientation( entityData.physics.orientation ); Rigidbody rigidbody = gO.GetComponent<Rigidbody>(); if( rigidbody == null ) { // simple movement - we just update the position and orientation, which results // in accurate but "jerky" movement of the entity gO.transform.position = unityPosition; gO.transform.rotation = unityOrientation; } else { // we have a rigidbody, so we can use the Unity physics engine to smooth some of // the movement and rotation out a bit LVCGame.Vector3 lvcVelocity = entityData.physics.worldVelocity; UnityEngine.Vector3 unityVelocity = new UnityEngine.Vector3( (float)lvcVelocity.x, (float)lvcVelocity.z, (float)lvcVelocity.y ); LVCGame.Vector3 lvcAngularVelocity = entityData.physics.bodyAngularVelocity; UnityEngine.Vector3 unityAngularVelocity = new UnityEngine.Vector3( -(float)LVCUtils.Radians2Degrees(lvcAngularVelocity.z), (float)LVCUtils.Radians2Degrees(lvcAngularVelocity.x), -(float)LVCUtils.Radians2Degrees(lvcAngularVelocity.y) ); rigidbody.velocity = unityVelocity; rigidbody.angularVelocity = unityAngularVelocity; rigidbody.position = unityPosition; rigidbody.rotation = unityOrientation; } // ground clamping for land entities --------------------------------------- if( LVCUtils.IsLandEntity(entityData) ) DoGroundClamping( gO, true ); // change colour of entity to indicate damage level ------------------------ // Note that an actual application would probably want to represent damage in a // more sophisticated way than that shown here. We simply gradually turn the // respresentation black, proportional to the amount of damage sustained. float damage = entityData.properties.damage; if( damage > 0.0F ) { Color damageColor = Color.Lerp( DAMAGE_000, DAMAGE_100, damage ); Renderer[] renderers = gO.GetComponentsInChildren<Renderer>(); foreach( Renderer renderer in renderers ) foreach( Material material in renderer.materials ) material.color = damageColor; } }
public MultiplayerControlSwitch(EntityData data, Vector2 offset) : this(data.Position + offset) { }
/** * Utility method to carry out tasks required for entity update events * * @param updates the data for the entity update events */ private void HandleUpdates( EntityData[] updates ) { foreach( EntityData entityData in updates ) { GameObject unityRepresentation = this.lvcUnityAmbassador.GameObjectForLvcId( entityData.id.instance ); if( unityRepresentation != null ) { AssignEntityDataToGameObject( entityData, unityRepresentation ); // check for any entity type specific handling for updates LVCExtraUpdateHandler extraUpdateHandler = unityRepresentation.GetComponent<LVCExtraUpdateHandler>(); if( extraUpdateHandler!=null ) { // there's additional work to be done using the update data - do that now. extraUpdateHandler.HandleExtra( entityData, unityRepresentation ); } } } if(showLogging && updates.Length>0) Debug.Log(updates.Length + " External Update Events Handled."); }
public static bool LoadCustomEntity(EntityData entityData, Level level) { LevelData levelData = level.Session.LevelData; Vector2 offset = new Vector2(levelData.Bounds.Left, levelData.Bounds.Top); if (Everest.Events.Level.LoadEntity(level, levelData, offset, entityData)) { return(true); } if (EntityLoaders.TryGetValue(entityData.Name, out EntityLoader loader)) { Entity loaded = loader(level, levelData, offset, entityData); if (loaded != null) { level.Add(loaded); return(true); } } if (entityData.Name == "everest/spaceController") { level.Add(new SpaceController()); return(true); } // The following entities have hardcoded "attributes." // Everest allows custom maps to set them. if (entityData.Name == "spinner") { if (level.Session.Area.ID == 3 || (level.Session.Area.ID == 7 && level.Session.Level.StartsWith("d-")) || entityData.Bool("dust")) { level.Add(new DustStaticSpinner(entityData, offset)); return(true); } CrystalColor color = CrystalColor.Blue; if (level.Session.Area.ID == 5) { color = CrystalColor.Red; } else if (level.Session.Area.ID == 6) { color = CrystalColor.Purple; } else if (level.Session.Area.ID == 10) { color = CrystalColor.Rainbow; } else if ("core".Equals(entityData.Attr("color"), StringComparison.InvariantCultureIgnoreCase)) { color = (CrystalColor)(-1); } else if (!Enum.TryParse(entityData.Attr("color"), true, out color)) { color = CrystalColor.Blue; } level.Add(new CrystalStaticSpinner(entityData, offset, color)); return(true); } if (entityData.Name == "trackSpinner") { if (level.Session.Area.ID == 10 || entityData.Bool("star")) { level.Add(new StarTrackSpinner(entityData, offset)); return(true); } else if (level.Session.Area.ID == 3 || (level.Session.Area.ID == 7 && level.Session.Level.StartsWith("d-")) || entityData.Bool("dust")) { level.Add(new DustTrackSpinner(entityData, offset)); return(true); } level.Add(new BladeTrackSpinner(entityData, offset)); return(true); } if (entityData.Name == "rotateSpinner") { if (level.Session.Area.ID == 10 || entityData.Bool("star")) { level.Add(new StarRotateSpinner(entityData, offset)); return(true); } else if (level.Session.Area.ID == 3 || (level.Session.Area.ID == 7 && level.Session.Level.StartsWith("d-")) || entityData.Bool("dust")) { level.Add(new DustRotateSpinner(entityData, offset)); return(true); } level.Add(new BladeRotateSpinner(entityData, offset)); return(true); } if (entityData.Name == "checkpoint" && entityData.Position == Vector2.Zero && !entityData.Bool("allowOrigin")) { // Workaround for mod levels with old versions of Ahorn containing a checkpoint at (0, 0): // Create the checkpoint and avoid the start position update in orig_Load. level.Add(new Checkpoint(entityData, offset)); return(true); } if (entityData.Name == "cloud") { patch_Cloud cloud = new Cloud(entityData, offset) as patch_Cloud; if (entityData.Has("small")) { cloud.Small = entityData.Bool("small"); } level.Add(cloud); return(true); } if (entityData.Name == "cobweb") { patch_Cobweb cobweb = new Cobweb(entityData, offset) as patch_Cobweb; if (entityData.Has("color")) { cobweb.OverrideColors = entityData.Attr("color")?.Split(',').Select(s => Calc.HexToColor(s)).ToArray(); } level.Add(cobweb); return(true); } if (entityData.Name == "movingPlatform") { patch_MovingPlatform platform = new MovingPlatform(entityData, offset) as patch_MovingPlatform; if (entityData.Has("texture")) { platform.OverrideTexture = entityData.Attr("texture"); } level.Add(platform); return(true); } if (entityData.Name == "sinkingPlatform") { patch_SinkingPlatform platform = new SinkingPlatform(entityData, offset) as patch_SinkingPlatform; if (entityData.Has("texture")) { platform.OverrideTexture = entityData.Attr("texture"); } level.Add(platform); return(true); } if (entityData.Name == "crumbleBlock") { patch_CrumblePlatform platform = new CrumblePlatform(entityData, offset) as patch_CrumblePlatform; if (entityData.Has("texture")) { platform.OverrideTexture = entityData.Attr("texture"); } level.Add(platform); return(true); } if (entityData.Name == "wire") { Wire wire = new Wire(entityData, offset); if (entityData.Has("color")) { wire.Color = entityData.HexColor("color"); } level.Add(wire); return(true); } return(false); }
/// <summary> /// This method will send notifications to external users /// </summary> /// <param name="externalSharingRequest"></param> /// <returns></returns> private GenericResponseVM SendExternalNotification(MatterInformationVM matterInformation, string permission, string externalEmail) { var clientUrl = $"{matterInformation.Client.Url}"; try { string roleId = ""; switch (permission.ToLower()) { case "full control": roleId = ((int)SPORoleIdMapping.FullControl).ToString(); break; case "contribute": roleId = ((int)SPORoleIdMapping.Contribute).ToString(); break; case "read": roleId = ((int)SPORoleIdMapping.Read).ToString(); break; } PeoplePickerUser peoplePickerUser = new PeoplePickerUser(); peoplePickerUser.Key = externalEmail; peoplePickerUser.Description = externalEmail; peoplePickerUser.DisplayText = externalEmail; peoplePickerUser.EntityType = ""; peoplePickerUser.ProviderDisplayName = ""; peoplePickerUser.ProviderName = ""; peoplePickerUser.IsResolved = true; EntityData entityData = new EntityData(); entityData.SPUserID = externalEmail; entityData.Email = externalEmail; entityData.IsBlocked = "False"; entityData.PrincipalType = "UNVALIDATED_EMAIL_ADDRESS"; entityData.AccountName = externalEmail; entityData.SIPAddress = externalEmail; peoplePickerUser.EntityData = entityData; string peoplePicker = Newtonsoft.Json.JsonConvert.SerializeObject(peoplePickerUser); peoplePicker = $"[{peoplePicker}]"; string roleValue = $"role:{roleId}"; bool sendEmail = true; bool includeAnonymousLinkInEmail = false; bool propagateAcl = false; bool useSimplifiedRoles = true; string matterLandingPageUrl = $"{clientUrl}/sitepages/{matterInformation.Matter.MatterGuid + ServiceConstants.ASPX_EXTENSION}"; string url = matterLandingPageUrl; string emailBody = $"The following information has been shared with you {matterInformation.Matter.Name}"; string emailSubject = $"The following information has been shared with you {matterInformation.Matter.Name}"; #region Doc Sharing API SharingResult sharingResult = null; using (var clientContext = spoAuthorization.GetClientContext(clientUrl)) { sharingResult = Web.ShareObject(clientContext, url, peoplePicker, roleValue, 0, propagateAcl, sendEmail, includeAnonymousLinkInEmail, emailSubject, emailBody, useSimplifiedRoles); clientContext.Load(sharingResult); clientContext.ExecuteQuery(); } return null; #endregion } catch (Exception ex) { throw; } }
private static bool OnLoadEntity(Level level, LevelData levelData, Vector2 offset, EntityData entityData) { switch (entityData.Name) { case "FrostHelper/KeyIce": level.Add(new KeyIce(entityData, offset, new EntityID(levelData.Name, entityData.ID), entityData.NodesOffset(offset))); return(true); /* * case "FrostHelper/SpringLeft": * level.Add(new CustomSpring(entityData, offset, Spring.Orientations.WallLeft)); * return true; * case "FrostHelper/SpringRight": * level.Add(new CustomSpring(entityData, offset, Spring.Orientations.WallRight)); * return true; * case "FrostHelper/SpringFloor": * level.Add(new CustomSpring(entityData, offset, Spring.Orientations.Floor)); * return true;*/ case "FrostHelper/CustomDreamBlock": if (entityData.Bool("old", false)) { #pragma warning disable CS0618 // Type or member is obsolete level.Add(new CustomDreamBlock(entityData, offset)); #pragma warning restore CS0618 // Type or member is obsolete } else { level.Add(new CustomDreamBlockV2(entityData, offset)); } return(true); default: return(false); } }