/// <summary> /// Function: Get data from a object to current object /// Author : Jerry Xu /// Date : 2008-7-8 /// </summary> /// <param name="memory">LibraryAdapter</param> public override void FromTo(LibraryAdapter item) { //this.Caption = memory.Caption; base.FromTo(item); //TODO: AppointmentInfo adp = item as AppointmentInfo; _allDay = adp._allDay; _description = adp._description; _duration = adp._duration; _end = adp._end; _hasReminder = adp._hasReminder; _labelId = adp._labelId; _location = adp._location; _exactTiming = adp._exactTiming; _playMessageOnce = adp._playMessageOnce; if (adp._recurrenceInfo != null) { _recurrenceInfo = CloneManager.Clone <PWRecurrenceInfo>(adp._recurrenceInfo); } else { _recurrenceInfo = null; } _resourceId = adp._resourceId; _start = adp._start; _statusId = adp._statusId; _subject = adp._subject; _type = adp._type; }
public Clone(int id) { sex = CloneManager.Get().GetCloneableData(id).Sex; seed = CloneManager.Get().GetCloneableData(id).RandomSeed; nameId = CloneManager.Get().GetCloneableData(id).IdentityId; wType = CloneManager.Get().GetCloneableData(id).WardrobeType; }
void Awake() { if (cm != null) { cm = this; } }
public static void Test() { User source = new User("ZhangSan"); User dest = CloneManager.Clone <User>(source); Debug.Assert(source.Name == dest.Name); }
private void simpleButton1_Click(object sender, EventArgs e) { SignInfo sign = new SignInfo(); textEdit2.Text = TemplateGroup.Default.Sign.Height.ToString(); sign.Template = CloneManager.Clone <TemplateGroup>(TemplateGroup.Default); sign.Template.Sign.Height = Convert.ToInt32(textEdit1.Text); bool b = sign.Template == TemplateGroup.Default; int i = TemplateGroup.Default.Sign.Height; }
public TemplateGroup Copy() { TemplateGroup clone = new TemplateGroup(); clone.Name = Name; clone._sign = CloneManager.Clone <SignTemplateInfo>(_sign); clone._scheduler = CloneManager.Clone <SchedulerTemplate>(_scheduler); clone._playlist = CloneManager.Clone <PlayListTemplate>(_playlist); clone._message = CloneManager.Clone <MessageTemplate>(_message); return(clone); }
public void ApplyClone(int id) { CloneManager.Get().GetCloneableData(id).Sex = sex; CloneManager.Get().GetCloneableData(id).m_Sex = sex; CloneManager.Get().GetCloneableData(id).RandomSeed = seed; CloneManager.Get().GetCloneableData(id).m_RandomSeed = seed; CloneManager.Get().GetCloneableData(id).IdentityId = nameId; CloneManager.Get().GetCloneableData(id).m_IdentityID = nameId; CloneManager.Get().GetCloneableData(id).WardrobeType = wType; CloneManager.Get().GetCloneableData(id).m_WardrobeType = wType; //CloneManager.Get().GetCloneableData(id).IdentityId = dataFrom.IdentityId; }
private void btnProfileDuplicate_Click(object sender, EventArgs e) { if (lvWorkflows.SelectedItems.Count > 0) { ListViewItem lvi = lvWorkflows.SelectedItems[0]; Workflow wf = Workflows[(int)lvi.Tag]; IClone cm = new CloneManager(); Workflow wf2 = cm.Clone<Workflow>(wf); wf2.Description = wf.Description + " - Copy"; Workflows.Add(wf2); WorkflowsGuiRefresh(); } }
private void btnProfileDuplicate_Click(object sender, EventArgs e) { if (lvWorkflows.SelectedItems.Count > 0) { ListViewItem lvi = lvWorkflows.SelectedItems[0]; Workflow wf = Workflows[(int)lvi.Tag]; IClone cm = new CloneManager(); Workflow wf2 = cm.Clone <Workflow>(wf); wf2.Description = wf.Description + " - Copy"; Workflows.Add(wf2); WorkflowsGuiRefresh(); } }
public void Start() { teamSeeds = new int[4]; seedMem = new int[5]; cloneMem = new Clone[5]; clones = new Clone[5]; int n = 0; foreach (AgentAI a in AgentAI.GetAgents()) { teamSeeds[n] = CloneManager.Get().GetCloneableData(a.CurrentCloneableId).m_RandomSeed; clones[n] = new Clone(a.CurrentCloneableId); a.AddAmmo(50); seedMem[n + 1] = CloneManager.Get().GetCloneableData(a.CurrentCloneableId).m_RandomSeed; cloneMem[n + 1] = new Clone(a.CurrentCloneableId); n++; } }
private void simpleButton1_Click(object sender, EventArgs e) { TemplateGroup test = new TemplateGroup(); test = CloneManager.Clone <TemplateGroup>(TemplateGroup.Default); test.Sign.Height = 210; //List<string> names = new List<string>(); //names.Add("AAAA"); //names.Add("BBBB"); //names.Add("CCCC"); //names.Add("DDDD"); //names.Add("EEEE"); //names.Add("FFFFF"); //names.Add("GGGGG"); //ListForm listForm = new ListForm("NameList", names); //if(listForm.ShowDialog() == DialogResult.OK) //{ // labelControl1.Text = listForm.SelectedName; //} }
/// <summary> /// Connect /// </summary> private void DoConnect() { if (connStatus != null) { return; } if (isUseProxy && ddlProxyType.SelectedIndex != 0) { if (txtProxyIpAdd.Text.Trim() == "") { MsgBox.Warning("Sorry,the proxy IP address can't be empty"); return; } if (this.txtProxyPortNo.Text.Trim() == "") { MsgBox.Warning("Sorry,the proxy port number can't be empty"); return; } } Cursor = Cursors.WaitCursor; ConnectionExceptionAction.IsCancel = false; IsDisconnection = false; DashboardTree._currentSign = Current; IPEndPoint endPoint = null; IPEndPoint proxyEndPoint = null; LoginInfo info = new LoginInfo(); if (Current.Template.Sign.AutoLogin || Current.LoginInfomation.CanSave || Current.LoginInfomation.CanSaveLoginInfo) { info = CloneManager.Clone <LoginInfo>(Current.LoginInfomation); } if (chkStorePWD.Checked) { info.CanSave = true; } else { info.CanSave = false; } info.IpAddress = txtConnectIpAddress.Text.Trim(); info.Port = Convert.ToInt32(txtConnectPortNo.Text); info.ConnectionUserName = txtServerName.Text.Trim(); info.ConnectionPassword = txtConnectPWD.Text.Trim(); Current.LoginInfomation.ConnectionUserName = txtServerName.Text.Trim(); Current.LoginInfomation.ConnectionPassword = txtConnectPWD.Text.Trim(); endPoint = new IPEndPoint(IPAddress.Parse(info.IpAddress), info.Port); if (isUseProxy && ddlProxyType.SelectedIndex != 0) { info.PorxyUserName = txtProxyUserName.Text; info.ProxyPort = Convert.ToInt32(txtProxyPortNo.Text); info.PorxyAddress = txtProxyIpAdd.Text; info.ProxyType = (ProxyTypes)Enum.Parse(typeof(ProxyTypes), ddlProxyType.SelectedItem.ToString()); info.PorxyPassword = txtProxyPWD.Text; proxyEndPoint = new IPEndPoint(IPAddress.Parse(this.txtProxyIpAdd.Text), Convert.ToInt32(this.txtProxyPortNo.Text)); } else { info.ProxyType = ProxyTypes.None; } Current.LoginInfomation = info; Current.Controller.Connection.FtpUser.Account = info.ConnectionUserName; Current.Controller.Connection.FtpUser.NoSecurityPWD = info.ConnectionPassword; TcpUFEConnection tcpConn = Current.Controller.Connection as TcpUFEConnection; if (tcpConn != null) { var connParams = new TcpConnectionParams(endPoint, proxyEndPoint, info.ProxyType, info.PorxyUserName, info.PorxyPassword); tcpConn.Params = connParams; } ProWrite.UI.Controls.Actions.UFE.Responses.UFEResponseService.Init(Current); this.Hide(); ConnectionProgress progress = new ConnectionProgress(Current, false, info.ConnectionPassword); progress.ShowModalDialog(); if (!chkStorePWD.Checked) { Current.LoginInfomation.ConnectionPassword = ""; } if (progress.Result) { LiveImageAction liveImageAction = new LiveImageAction(); liveImageAction.Sign = Current; liveImageAction.Perform(); StatusAction statusAction = new StatusAction(false); statusAction.Sign = Current; statusAction.Perform(); GetStatusAction getStatus = new GetStatusAction(); getStatus.sign = Current; getStatus.Perform(); LogViewAction logviewAction = new LogViewAction(); logviewAction.sign = Current; logviewAction.Perform(); if (Current.IsWebCam) { IsConnectWebCam = true; } UpdateSignInfo(); } else { ActionHelper.OnDisconnected(false); this.Show(); this.Cursor = Cursors.Default; } }
/// <summary> /// Called once per frame. /// </summary> public void Update() { if (Manager.Get().GameInProgress) { if (Input.GetKeyDown(KeyCode.M)) { foreach (AgentAI a in AgentAI.GetAgents()) { if (a.IsSelected()) { if (CloneManager.Get().GetCloneableData(a.CurrentCloneableId).Sex == WardrobeManager.Sex.Female) { CloneManager.Get().GetCloneableData(a.CurrentCloneableId).Sex = WardrobeManager.Sex.Male; } else { CloneManager.Get().GetCloneableData(a.CurrentCloneableId).Sex = WardrobeManager.Sex.Female; } //CloneManager.Get().GetCloneableData(a.CurrentCloneableId).m_RandomSeed -= 10; RespawnAgent(a); } } } if (Input.GetKeyDown(KeyCode.End)) { string info = ""; int n = 0; foreach (AgentAI a in Manager.GetInputControl().GetSelectedAgents()) { //CloneManager.Get().GetCloneableData(a.CurrentCloneableId).m_RandomSeed = teamSeeds[n]; clones[n].ApplyClone(a.CurrentCloneableId); RespawnAgent(a); if (info != "") { info += "\n"; } info += a.AgentClassName() + " got " + clones[n].GetInfo(); n++; } setEntityInfo("Agent Clone Data applied", info); } if (Input.GetKeyDown(KeyCode.Home)) { string info = ""; int n = 0; foreach (AgentAI a in AgentAI.GetAgents()) { //copyClone(CloneManager.Get().GetCloneableData(a.CurrentCloneableId), ref clones[n]); teamSeeds[n] = CloneManager.Get().GetCloneableData(a.CurrentCloneableId).m_RandomSeed; if (clones.Length != 5) { clones = new Clone[5]; } clones[n] = new Clone(a.CurrentCloneableId); if (info != "") { info += "\n"; } info += a.AgentClassName() + " info: " + clones[n].GetInfo(); n++; } setEntityInfo("Agent Clone Data Stored", info); } if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Keypad1)) { memSet(1); } else if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Keypad2)) { memSet(2); } else if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Keypad4)) { memGet(1); } else if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Keypad5)) { memGet(2); } else if (Input.GetKeyDown(KeyCode.Keypad1)) { memSet(1); } else if (Input.GetKeyDown(KeyCode.Keypad2)) { memSet(2); } else if (Input.GetKeyDown(KeyCode.Keypad3)) { memSet(3); } else if (Input.GetKeyDown(KeyCode.Keypad4)) { memGet(1); } else if (Input.GetKeyDown(KeyCode.Keypad5)) { memGet(2); } else if (Input.GetKeyDown(KeyCode.Keypad6)) { memGet(3); } if (Input.GetKeyDown(KeyCode.Keypad8)) { string info = ""; foreach (AgentAI a in AgentAI.GetAgents()) { if (a.IsSelected()) { int numberOfWardrobeTypes = System.Enum.GetValues(typeof(WardrobeManager.WardrobeType)).Length; int typeNo = UnityEngine.Random.Range(0, numberOfWardrobeTypes); WardrobeManager.WardrobeType wType = (WardrobeManager.WardrobeType)typeNo; //a.name = "Caldor"; //a.InitRandomSeed(); //a.m_Identity.NameID = IdentityManager.GetRandomNameID(CloneManager.Get().GetCloneableData(a.CurrentCloneableId).Sex); CloneManager.Get().GetCloneableData(a.CurrentCloneableId).m_RandomSeed = Wardrobe.GenerateRandomSeed(); a.m_Wardrobe.m_Sex = Wardrobe.GenerateRandomSex(); a.m_Wardrobe.m_WardrobeType = wType; //a.m_Wardrobe.bod = Wardrobe.CreateRandomBodyData(); Wardrobe.BodyData body = a.m_Wardrobe.GetBodyData(); //body.m_HairColor1 = Color.yellow; //body.m_HairColor2 = Color.green; //body.m_LowerPrimaryColor = Color.red; //body.m_LowerSecondaryColor = Color.red; //body.m_SkinColor = Color.blue; //a.m_Wardrobe.SetBodyData(body, a.m_Wardrobe.m_Sex, a.m_Wardrobe.RandomSeed, a.m_Wardrobe.m_WardrobeType); RespawnAgent(a); info += "Hair:" + body.m_HairColor1.ToString() + " & " + body.m_HairColor2.ToString() + ". skin: " + body.m_SkinColor.ToString(); } } setEntityInfo("Randomized", info); } if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Keypad9)) { int numberOfWardrobeTypes = System.Enum.GetValues(typeof(WardrobeManager.WardrobeType)).Length; int typeNo = UnityEngine.Random.Range(0, numberOfWardrobeTypes); WardrobeManager.WardrobeType wType = (WardrobeManager.WardrobeType)typeNo; foreach (AgentAI a in Manager.GetInputControl().GetSelectedAgents()) { a.m_Wardrobe.m_WardrobeType = wType; RespawnAgent(a); } } else if (Input.GetKeyDown(KeyCode.Keypad9)) { string info = ""; string first; string last; foreach (AgentAI a in Manager.GetInputControl().GetSelectedAgents()) //AgentAI.GetAgents()) { int nameId = IdentityManager.GetRandomNameID(a.m_Wardrobe.m_Sex); int currentNameId = Mathf.RoundToInt(a.CurrentCloneableId); int cloneId = a.CurrentCloneableId; CloneableData cData = CloneManager.Get().GetCloneableData(cloneId); IdentityManager.Get().GetName(cData.IdentityId, out first, out last); info += "Name based on identity Id: " + cData.IdentityId + " is " + first + " " + last + "\n"; //info += "Clonable name: " + a.GetCloneable().name + "\n"; info += currentNameId + ": " + first + " " + last; IdentityManager.Get().GetName(cData.m_IdentityID, out first, out last); //a.m_Identity.NameID = nameId; //a.m_Wardrobe.m_WardrobeType = WardrobeManager.WardrobeType.AgentSupportBacker; info += " changing name To " + nameId + ": " + first + " " + last + "\n"; Manager.GetUIManager().ShowMessagePopup(info, 6); cData.IdentityId = nameId; cData.m_IdentityID = nameId; //cData.WardrobeType = WardrobeManager.WardrobeType.Prostitute2; //a.name = "Caldor"; //a.InitRandomSeed(); //a.m_Identity.NameID = IdentityManager.GetRandomNameID(CloneManager.Get().GetCloneableData(a.CurrentCloneableId).Sex); //CloneManager.Get().GetCloneableData(a.CurrentCloneableId).m_RandomSeed = Wardrobe.GenerateRandomSeed(); //a.m_Wardrobe.m_Sex = WardrobeManager.Sex.Male; //a.m_Wardrobe.bod = Wardrobe.CreateRandomBodyData(); Wardrobe.BodyData body = a.m_Wardrobe.GetBodyData(); //body.m_HairColor1 = Color.black; //body.m_HairColor2 = Color.black; //body.m_LowerPrimaryColor = Color.black; //body.m_LowerSecondaryColor = Color.black; //body.m_SkinColor = Color.black; //a.m_Wardrobe.SetBodyData(body, a.m_Wardrobe.m_Sex, a.m_Wardrobe.RandomSeed, a.m_Wardrobe.m_WardrobeType); RespawnAgent(a); info += a.AgentClassName() + " got Hair: " + body.m_HairColor1 + " & " + body.m_HairColor1 + ".\nskin: " + body.m_SkinColor; info += "\nWardrope type: " + a.m_Wardrobe.m_WardrobeType + "\n"; } setEntityInfo("Selected agent", info); } if (Input.GetKeyDown(KeyCode.Keypad0)) { string info = ""; string first; string last; AgentAI a = AgentAI.FirstSelectedAgentAi(); if (a != null) { int cloneId = a.CurrentCloneableId; CloneableData cData = CloneManager.Get().GetCloneableData(cloneId); IdentityManager.Get().GetName(cData.IdentityId, out first, out last); info += "Selected person is " + first + " " + last + ", gender " + cData.Sex; info += ". Seed is:" + cData.RandomSeed + ", mSeed is:" + cData.m_RandomSeed + " and wardrobe type is " + cData.WardrobeType; info += ". Palette: " + cData.WardrobeConfigurationData.m_DefaultColorPaletteName; } else { foreach (AIEntity ae in AIEntity.FindObjectsOfType(typeof(AIEntity))) { if (ae.IsSelected()) { ae.m_IsControllable = true; IdentityManager.Get().GetName(ae.m_Identity.NameID, out first, out last); info += "Selected person is " + first + " " + last + ", gender " + ae.m_Wardrobe.m_Sex; info += ". Seed is:" + ae.m_Wardrobe.RandomSeed + " Wardrobe type is " + ae.m_Wardrobe.m_WardrobeType; info += ". Palette: " + ae.m_Wardrobe.DefaultColorPaletteName; break; } } } setEntityInfo("Selected AI info", info); } } }
public void memGet(int n) { bool done = false; string info = ""; AgentAI ai = null; foreach (AgentAI a in AgentAI.GetAgents()) { if (a.IsSelected() && (Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl))) { a.m_Identity.NameID = nameIDs[n]; } else if (a.IsSelected() && cloneMem[n] != null) { cloneMem[n].ApplyClone(a.CurrentCloneableId); //a.m_Wardrobe.CopyFrom(); //a.RespawnAtCurrentLocation(); RespawnAgent(a); info += "Clone seed: " + cloneMem[n].seed; done = true; } else if (a.IsSelected() && 2 < seedMem[n]) { //applyClone(cloneMem[n], a.CurrentCloneableId); CloneManager.Get().GetCloneableData(a.CurrentCloneableId).m_RandomSeed = seedMem[n]; //a.RespawnAtCurrentLocation(); RespawnAgent(a); //break; info += "Seed: " + seedMem[n]; done = true; } } if (cloneMem[1] != null) { info += "Seed 1: " + cloneMem[1].seed; } if (cloneMem[2] != null) { info += "\nSeed 2: " + cloneMem[2].seed; } if (cloneMem[3] != null) { info += "\nSeed 3: " + cloneMem[3].seed; } setEntityInfo("Seeds in memory: ", info); if (done) { Manager.GetUIManager().ShowMessagePopup("Clone seed " + n + ": " + cloneMem[n].seed + " put into" + ai.AgentClassName(), 8); } else { string first; string last; if (Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl) && nameIDs[n] != 0) { IdentityManager.Get().GetName(nameIDs[n], out first, out last); Manager.GetUIManager().ShowMessagePopup("NameId " + nameIDs[n] + " from nameId mem slot " + n + ", name " + first + " " + last + " applied.", 8); } else { IdentityManager.Get().GetName(cloneMem[n].nameId, out first, out last); Manager.GetUIManager().ShowMessagePopup("Clone seed " + n + ": " + cloneMem[n].seed + " name id: " + cloneMem[n].nameId + ", name " + first + " " + last, 8); } } }
public T Clone <T>(T objectToClone) where T : class, IObjectBase { return(CloneManager.Clone(objectToClone)); }
public WorkerTask(Workflow wf, bool cloneWorkflow = true) { Info = new TaskInfo(); UploadResults = new List<UploadResult>(); Errors = new List<string>(); States.Add(TaskState.Created); MyWorker = new BackgroundWorker { WorkerReportsProgress = true }; if (cloneWorkflow) { IClone cm = new CloneManager(); WorkflowConfig = cm.Clone(wf); } else { WorkflowConfig = wf; } }
// Use this for initialization void Awake() { cm = this; }
/** <summary> * Clone Unity StreamingAssets * </summary> * <remarks> * File to copy * </remarks> * */ public static void AndroidCloneResources(string xml) { string data; string old_xml = Application.persistentDataPath + xml.Replace(Application.streamingAssetsPath, "/StreamingAssets"); // Check if conf xml already exist in internal storage if (File.Exists(old_xml)) { xml = old_xml; Debug.LogWarning("[ANDROID] Configuration xml found in internal memory : " + xml + "\n It will be used for configuration"); } else { Debug.LogWarning("[ANDROID] No configuration xml found in internal memory : " + old_xml + "\n " + xml + " will be used for configuration"); } // Get configuration xml data if (!xml.Equals(old_xml)) { //WWW request on .apk UnityWebRequest www = new UnityWebRequest(xml); www.downloadHandler = new DownloadHandlerBuffer(); UnityWebRequestAsyncOperation request = www.SendWebRequest(); while (!request.isDone) { } if (www.isNetworkError || www.isHttpError) { Debug.LogError("[ANDROID] WWW request on : " + xml + " : " + www.error + " cloning of resources canceled"); www.downloadHandler.Dispose(); return; } data = www.downloadHandler.text; www.downloadHandler.Dispose(); string _byteOrderMarkUtf8 = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble()); if (data.Length > 0 && data.StartsWith(_byteOrderMarkUtf8)) { data = data.Remove(0, _byteOrderMarkUtf8.Length); } } else { //Read conf file in system storage StreamReader input = new StreamReader(xml); data = input.ReadToEnd(); input.Close(); } // Clone content in external directory with correct path CloneManager clone = new CloneManager(); var doc = XDocument.Parse(data.ToString()); var file = new[] { doc.Element("assets").Element("streamingAssets").Elements("file") }; foreach (var f in file) { foreach (var attribute in f.Attributes()) { if (attribute.Name == "path") { //update path for terminal string src = ""; string output = ""; if (attribute.Value.Contains("StreamingAssets")) { src = attribute.Value.Replace("./assets/StreamingAssets", Application.streamingAssetsPath); output = attribute.Value.Replace("./assets", Application.persistentDataPath); } if ((attribute.Parent.Attribute("overWrite") != null && attribute.Parent.Attribute("overWrite").Value.Equals("true")) || !File.Exists(output)) { //Overwrite clone.Add(src, output); } } } } Debug.Log(clone); clone.Execute(); }