private IEnumerator StartCreateAgents() { AJPHelper.Operation oper = UnitTable.Operation; while (!oper.IsDone) { yield return(null); } int i = 0; int count = UnitTable.Count; UnitRow unitData = null; UserInfoRow user = null; while (i < count) { unitData = UnitTable.ReadOnlyRows[i]; user = Users.GetUserById(unitData.ID_User); Create(unitData, user); i++; yield return(null); } yield break; }
public void Dispose() { actions?.Clear(); package = null; unit = null; inited = false; }
public AddOrUpdateUnitsDialog(int id) { InitializeComponent(); unit = unitTableAdapter1.GetData().FirstOrDefault(p => p.ID == id); txtName.Text = unit.Name; isNew = false; }
public void RefreshSubject(UnitRow subject) { if (!inited) { unit = subject; inited = true; } }
/// <summary> /// Shows the window and creates a new row for every unit in the building. /// </summary> public void Show(Building building, List <Unit> units, Action <Unit> action, string actionName) { nameText.text = building.Name; units.ForEach(u => { UnitRow unitRow = Instantiate(unitRowPrefab, unitsArea.transform).GetComponent <UnitRow>(); unitRow.Init(building, u, action, actionName); unitRows.Add(unitRow); }); gameObject.SetActive(true); }
public void SubjectUpdated(object dataPacked) { package = dataPacked as Package; //Debugger.Log(package.Unit); if (unit.CompareTo(package.Unit) == 0) { unit = package.Unit; for (int i = 0; i < actions.Count; i++) { actions[i].Invoke(package); } } }
public void SetInfo(UnitRow info, UserInfoRow user, bool isOwner) { agentInfo = info; userInfo = user; SetMaxHP(agentInfo.Health); SetHp(agentInfo.Hea_cur); SetQuality(agentInfo.Quality); string nameFormat = isOwner ? "{0}" : "<color=red>{0}</color>"; SetNameInGame(string.Format(nameFormat, userInfo.ID_User + ": " + " Id " + agentInfo.ID)); }
private void R_DEPLOY(SocketIOEvent obj) { Debugger.Log(obj); string json = obj.data["R_DEPLOY"].ToString(); UnitRow unit = JsonUtility.FromJson <UnitRow>(json); UserInfoRow user = SyncData.UserInfos.GetUserById(unit.ID_User); unitDataReference.Create(unit, user); JSONTable_Unit units = SyncData.UnitTable; units.Insert(unit); //SelectAgentPanel.Add(unit); //Debugger.Log("added " + unit.ID); }
public void Create(UnitRow unitData, UserInfoRow user) { AgentRemote agentRemote = AgentPooling.GetItem(unitData.ID_Unit); if (agentRemote == null || user == null) { return; } else { agentRemote.Dispose(); this.AddAgent(unitData.ID, agentRemote); LightweightLabel label = labelPooling.GetItem(); agentRemote.transform.position = MapIns.CellToWorld(unitData.Position_Cell.Parse3Int().ToClientPosition()); agentRemote.OnDead += delegate { AgentPooling.Release(agentRemote.Type, agentRemote); labelPooling.Release(label); MyAgentRemoteManager.Remove(agentRemote.AgentID); this.RemoveAgent(agentRemote.AgentID); }; label.Initalize(agentRemote, MainCamera); bool isOwner = unitData.ID_User == PlayerInfo.Info.ID_User; agentRemote.Initalize(UnitTable, label, unitData, user, isOwner); if (isOwner) { if (agentRemote.NavAgent == null) { agentRemote.gameObject.AddComponent <NavAgent>(); } MyAgentRemoteManager.Add(agentRemote); agentRemote.name = "Owner " + unitData.ID; } else { agentRemote.name = "other " + unitData.ID; } agentRemote.gameObject.SetActive(true); } }
/// <summary> /// /// </summary> /// <returns></returns> private void unitPositionEditor(ref UnitPosition position) { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.BeginVertical(); { GUILayout.Label("Column"); //position.Column = EditorGUILayout.IntField(position.Column); position.Column = EditorGUILayout.IntSlider(position.Column, 0, 4); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(); { UnitRow row = (UnitRow)position.Row; GUILayout.Label("Row"); position.Row = (int)((UnitRow)EditorGUILayout.EnumPopup(row)); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); }
public JSONObject CreateAttackInfo(AgentRemote ownerRemote, AgentRemote otherRemote) { InfoDict.Clear(); UnitRow ownerUnit = ownerRemote.UnitInfo; UnitRow otherUnit = otherRemote.UnitInfo; InfoDict["Server_ID"] = ownerRemote.UserInfo.Server_ID; InfoDict["ID_Attack"] = ownerUnit.ID.ToString(); InfoDict["ID_Unit_Attack"] = ((int)ownerUnit.ID_Unit).ToString(); InfoDict["ID_User_Attack"] = ownerUnit.ID_User.ToString(); InfoDict["ID_Defend"] = otherUnit.ID.ToString(); InfoDict["ID_Unit_Defend"] = ((int)otherUnit.ID_Unit).ToString(); InfoDict["ID_User_Defend"] = otherUnit.ID_User.ToString(); InfoDict["Position_Cell_Attacker"] = ownerRemote.CurrentPosition.ToSerPosition().ToPositionString(); JSONObject data = new JSONObject(infoDict); Debugger.Log(data); return(data); }
public void Initalize( JSONTable_Unit subject, LightweightLabel label, UnitRow unitData, UserInfoRow user, bool isOwner) { Label = label; unitSubject = subject; AgentInfo.UserInfo = user; AgentInfo.UnitInfo = unitData; IsOwner = isOwner; //string format = IsOwner ? "{0}" : "<color=red>{0}</color>"; // not friend //if (!IsOwner) //{ // bool isFriend = Singleton.Instance<FriendSys>().IsMyFriend(user.ID_User); // format = isFriend ? "<color=green>{0}</color>" : format; // friend //} string format = GetLabelFormat(); Label.NameInGame = string.Format(format, "Id " + unitData.ID + ": " + user.NameInGame); Label.SetHP(unitData.Hea_cur, unitData.Health); Label.Quality = unitData.Quality; Label.gameObject.SetActive(true); observer = subject.ObserverPooling.GetItem(); observer.RefreshSubject(unitData); observer.OnSubjectUpdated += SubjectChanged; subject.Register(observer); }
public void R_DEPLOY(SocketIOEvent obj) { //Debugger.Log(obj); string json = obj.data["R_DEPLOY"].ToString(); UnitRow unit = JsonUtility.FromJson <UnitRow>(json); AgentRemote agent = MyAgent.GetNavRemote(unit.ID); int posCount = positions.Count; if (agent != null && posCount > 0) { agent.NavAgent.AsyncStartMove(agent.CurrentPosition, positions[posCount - 1], null); positions.RemoveAt(posCount - 1); if (positions.Count > 0) { Debugger.Log("start coroutine"); StartCoroutine(DeployCoroutine()); } } else { Debugger.Log("Agent null " + unit.ID); } }
public ProductRow AddProductRow( string Name, string SmallName, decimal PriceManufact, UnitRow parentUnitRowByFK_Product_Unit, PackingRow parentPackingRowByFK_Product_Packing, StorageConditionRow parentStorageConditionRowByFK_Product_StorageCondition, SubstanceRow parentSubstanceRowByFK_Product_Substance, FarmGroupLevel2Row parentFarmGroupLevel2RowByFK_Product_FarmGroupLevel2, bool IsRecept, bool IsOneRecept, bool IsHide, short MinDivisor, bool IsNDS, int OldKol, int OldKod, string OldName, string Note, string AuthorCreate, string AuthorLastModif, System.DateTime DateLastModif, System.DateTime DateCreate, byte[] RowVersion) { ProductRow rowProductRow = ((ProductRow)(this.NewRow())); rowProductRow.ItemArray = new object[] { null, Name, SmallName, PriceManufact, parentUnitRowByFK_Product_Unit[0], parentPackingRowByFK_Product_Packing[0], parentStorageConditionRowByFK_Product_StorageCondition[0], parentSubstanceRowByFK_Product_Substance[0], parentFarmGroupLevel2RowByFK_Product_FarmGroupLevel2[0], IsRecept, IsOneRecept, IsHide, MinDivisor, IsNDS, OldKol, OldKod, OldName, Note, AuthorCreate, AuthorLastModif, DateLastModif, DateCreate, RowVersion}; this.Rows.Add(rowProductRow); return rowProductRow; }
public UnitRowChangeEvent(UnitRow row, System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; }
public void RemoveUnitRow(UnitRow row) { this.Rows.Remove(row); }
public void AddUnitRow(UnitRow row) { this.Rows.Add(row); }
public Observer_Unit(UnitRow subject) { unit = subject; inited = true; }