public void CheckAttitudeObject() { MAVLink.mavlink_attitude_t data = new MAVLink.mavlink_attitude_t(); data.pitch = 1; data.pitchspeed = 2; data.roll = 3; data.rollspeed = 4; data.time_boot_ms = 5; data.yaw = 6; data.yawspeed = 7; MavLinkMessage message = createSampleMessage(MAVLink.MAVLINK_MSG_ID.ATTITUDE, data); Attitude obj = new Attitude(message); Assert.AreEqual(data.pitch, obj.pitch); Assert.AreEqual(data.pitchspeed, obj.pitchspeed); Assert.AreEqual(data.roll, obj.roll); Assert.AreEqual(data.rollspeed, obj.rollspeed); Assert.AreEqual(data.time_boot_ms, obj.time_boot_ms); Assert.AreEqual(data.yaw, obj.yaw); Assert.AreEqual(data.yawspeed, obj.yawspeed); AttitudeDTO dto = DTOFactory.createAttitudeDTO(obj); Assert.AreEqual(dto.pitch, obj.pitch); Assert.AreEqual(dto.pitchspeed, obj.pitchspeed); Assert.AreEqual(dto.roll, obj.roll); Assert.AreEqual(dto.rollspeed, obj.rollspeed); Assert.AreEqual(dto.time_boot_ms, obj.time_boot_ms); Assert.AreEqual(dto.yaw, obj.yaw); Assert.AreEqual(dto.yawspeed, obj.yawspeed); }
/// <summary> /// Assigns a new attitude to the driver based on traffic conditions /// </summary> /// <param name="attitudeAdjust">The adjustment to the driver's attitude based on traffic conditions</param> /// <param name="attitude">The current attitude of the driver</param> /// <returns></returns> public Attitude ChangeAttitude(int attitudeAdjust, Attitude attitude) { int newAttitude = (int)attitude + attitudeAdjust; if (newAttitude <= 0) //Attitude is or is better than the best attitude { return(Attitude.HAPPY); } else if (newAttitude == 1) { return(Attitude.CALM); } else if (newAttitude == 2) { return(Attitude.AVERAGE); } else if (newAttitude == 3) { return(Attitude.NERVOUS); } else if (newAttitude == 4) { return(Attitude.RUSHED); } else //Attitude is or is worse than the worst possible attitude { return(Attitude.ROAD_RAGE); } }
public Telemetry(bool test) { altitude = 3; gps_location.latitude = 52.085234; gps_location.longitude = 18.869299; attitude = new Attitude() { pitch = 0, yaw = 0, roll = 0 }; if (GlobalValues.MODE == 3 || GlobalValues.MODE == 4) { client = new Client(GlobalValues.HOST, GlobalValues.PORT); client.OnDataRecived += got_data; client.connect(); tcpMessagesQueue.Enqueue("y" + attitude.yaw.ToString() + ","); tcpMessagesQueue.Enqueue("l" + gps_location.latitude.ToString() + ","); tcpMessagesQueue.Enqueue("g" + gps_location.longitude.ToString() + ","); tcpMessagesQueue.Enqueue("a" + altitude.ToString() + ","); Thread tcpThread = new Thread(new ThreadStart(this.tcp_loop)); tcpThread.IsBackground = true; tcpThread.Start(); } }
public string GetString(BaseConvo npc, Mobile pc) { Attitude test = npc.Attitude; while (true) { for (int i = 0; i < m_Atts.Length; i++) { if (m_Atts[i] == test) { string str = null; for (int s = 0; s < m_Strings.Length && str == null; s++) { str = m_Strings[s].GetString(npc, pc); } return(str); } } if (test < Attitude.Neutral) { test = (Attitude)(((int)test) + 1); } else if (test > Attitude.Neutral) { test = (Attitude)(((int)test) - 1); } else { break; } } return(null); }
private static DeclareOrder ReadDeclareOrder(Faction faction, string s) { // declare 12 neutral DeclareOrder ord = new DeclareOrder(); string t1 = MyStrings.GetToken(ref s).ToLower(); if (t1 == "default") { ord.FactionNum = faction.Num; } else if (!MyStrings.IsNumber(t1)) { throw new Exception("Bad faction"); } ord.FactionNum = Convert.ToInt32(t1); string t2 = MyStrings.GetQuotedToken(ref s); Attitude a = Attitude.Hostile; while (a <= Attitude.Ally && a.ToString().ToLower() != t2) { a++; } if (a > Attitude.Ally) { throw new Exception("Bad attitude"); } ord.Attitude = a; return(ord); }
public async Task <CommentLikeStatusDTOout> SetVoteAsync(CommentVoteDTOin commentVote, string userId) { Attitude newAttitude = commentVote.Like ? Attitude.Like : Attitude.Dislike; CommentAttitude voteFd = await this.atttitudeRepo.All().FirstOrDefaultAsync(x => x.ShitGiverId == userId && x.CommentId == commentVote.Id); if (voteFd != null && voteFd.Attitude == newAttitude) { throw new ArgumentException("Same attitude can not be reasigned!"); } if (voteFd is null) { await this.atttitudeRepo.AddAssync(new CommentAttitude { ShitGiverId = userId, CommentId = commentVote.Id, Attitude = newAttitude }); } else { voteFd.IsDeleted = false; voteFd.Attitude = newAttitude; } await atttitudeRepo.SaveChangesAsync(); return(await this.commentRepo.All().Where(x => x.Id == commentVote.Id && !x.IsDeleted).To <CommentLikeStatusDTOout>().FirstOrDefaultAsync()); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; // Suitable nullity checks etc, of course :) hashCode = hashCode * 59 + EnergyCubes.GetHashCode(); hashCode = hashCode * 59 + Health.GetHashCode(); hashCode = hashCode * 59 + Active.GetHashCode(); hashCode = hashCode * 59 + Virtual.GetHashCode(); hashCode = hashCode * 59 + Priority.GetHashCode(); hashCode = hashCode * 59 + OnTurn.GetHashCode(); hashCode = hashCode * 59 + IsMine.GetHashCode(); hashCode = hashCode * 59 + HandCards.GetHashCode(); hashCode = hashCode * 59 + Attitude.GetHashCode(); hashCode = hashCode * 59 + Type.GetHashCode(); return(hashCode); } }
public Actor(string name, string description) { Name = name; Description = description; Attitude = Attitude.Friendship; MaxAttitude = Attitude.Friendship; }
/// <summary> /// 封装顶踩控件 /// </summary> /// <param name="htmlHelper"></param> /// <param name="objectId">被顶踩的对象id</param> /// <param name="userId">被顶踩的对象的UserId,用于限制不能顶踩自己</param> /// <param name="tenantTypeId">租户类型id</param> /// <param name="mode">双向操作还是单向操作</param> /// <param name="style">顶踩的样式</param> /// <param name="onSuccessCallBack">js回调函数</param> /// <returns></returns> public static MvcHtmlString SupportOppose(this HtmlHelper htmlHelper, string tenantTypeId, long objectId, long userId, AttitudeMode mode, AttitudeStyle?style = null, string onSuccessCallBack = null) { IUser CurrentUser = UserContext.CurrentUser; AttitudeService attitudeService = new AttitudeService(tenantTypeId); //查询当前登录用户是否顶踩过该对象 bool?isSupport = null; if (CurrentUser != null) { isSupport = attitudeService.IsSupport(objectId, CurrentUser.UserId); } htmlHelper.ViewData["isSupport"] = isSupport; //查询该对象总的顶踩次数 Attitude attitude = attitudeService.Get(objectId); htmlHelper.ViewData["attitude"] = attitude; //向View传递用户设置参数 htmlHelper.ViewData["tenantTypeId"] = tenantTypeId; htmlHelper.ViewData["objectId"] = objectId; htmlHelper.ViewData["userId"] = userId; htmlHelper.ViewData["mode"] = mode; htmlHelper.ViewData["style"] = style; htmlHelper.ViewData["onSuccessCallBack"] = onSuccessCallBack; //顶踩的全局设置 htmlHelper.ViewData["attitudeSettings"] = DIContainer.Resolve <IAttitudeSettingsManager>().Get(); ; return(htmlHelper.DisplayForModel("SupportOppose")); }
private void addNewAttitudeToolStripMenuItem_Click(object sender, EventArgs e) { MaterialMessageInput.MessageBoxResultInput result = MaterialMessageInput.Show("Ce nume are noua atitudine?", "Easy Survey - Add New Attitude", MaterialMessageInput.MessageBoxButtonsInput.OKCancel, addAttitude: true); if (result == MaterialMessageInput.MessageBoxResultInput.OK) { string AttitudeName = MaterialMessageInput.Answer; Attitude newAttitude = new Attitude { AttitudeName = AttitudeName }; using (AttitudeController attitudeController = new AttitudeController()) attitudeController.Add(ref newAttitude); Attitudes.Add(newAttitude); ListViewItem newAttitudeItem = new ListViewItem(listView_AllAttitudes.Groups["default"]) { Tag = newAttitude.AttitudeID.ToString(), Text = newAttitude.AttitudeName }; listView_AllAttitudes.Items.Add(newAttitudeItem); int AttitudeIndex = listView_AllAttitudes.Items.Count - 1; listView_AllAttitudes.Items[AttitudeIndex].Selected = true; listView_AllAttitudes.Items[AttitudeIndex].Focused = true; listView_AllAttitudes.Items[AttitudeIndex].EnsureVisible(); } }
private void UpdateSelectedAttitude(long AttitudeID, ListView listView) { using (AttitudeController attitudeController = new AttitudeController()) { Attitude selectedAttitude = attitudeController.GetAttitude(AttitudeID); if (LoggedUser.IsAdministrator()) { txt_EditAttitudeDetailsName.Text = selectedAttitude.AttitudeName; txt_EditAttitudeDetailsName.Tag = selectedAttitude.AttitudeID.ToString(); SelectedAttitudeOriginalName = selectedAttitude.AttitudeName; IsSelectedAttitudeOriginalNameChanged = false; } } listView.Clear(); using (QuestionController questionController = new QuestionController()) { List <Question> Questions = questionController.GetQuestionsForAttitude(AttitudeID); foreach (Question question in Questions) { listView.Items.Add(new ListViewItem(question.Question1) { Tag = question.QuestionID }); } } }
public override int GetHashCode() { int hash = 1; if (header_ != null) { hash ^= Header.GetHashCode(); } if (position_ != null) { hash ^= Position.GetHashCode(); } if (velocity_ != null) { hash ^= Velocity.GetHashCode(); } if (attitude_ != null) { hash ^= Attitude.GetHashCode(); } hash ^= pvaCovar_.GetHashCode(); if (InitAndAlignment != false) { hash ^= InitAndAlignment.GetHashCode(); } return(hash); }
public void Parse(Faction faction, string arguments) { // declare 12 neutral string factionToken = MyStrings.GetToken(ref arguments).ToLower(); if (factionToken == "default") { // TODO: correct the logic // the logic here is mangled, it does work but I don't like it // it would be better to have class element public bool default instead this.FactionNum = faction.Num; } else { if (!MyStrings.IsNumber(factionToken)) { throw new Exception("Bad faction"); } // TODO: missing check for existance of faction this.FactionNum = Convert.ToInt32(factionToken); } string attitudeToken = MyStrings.GetQuotedToken(ref arguments).ToLower(); Attitude attitude = Attitude.Hostile; while (attitude <= Attitude.Ally && attitude.ToString().ToLower() != attitudeToken) { attitude++; } if (attitude > Attitude.Ally) { throw new Exception("Bad attitude " + attitudeToken); } this.Attitude = attitude; }
public string GetString(BaseConvo npc, Mobile pc) { Attitude test = npc.Attitude; for (int i = 0; i < m_Atts.Length; i++) { if (m_Atts[i] == test) { string str = null; for (int s = 0; s < m_Strings.Length && str == null; s++) { str = m_Strings[s].GetString(npc, pc); } return(str); } } // If we're here, it means that no corresponding attitude phrase has been found. // What happens when no matching Attitude is found? There's a generic npc response. // So basically, we'll find a pseudo "closest" attitude to use. //If Belligerent -> go to Random(Wicked, Neutral) // If Kindly -> go to Random(Neutral, Goodhearted) // Then retry. Attitude closeAttitude; int result = -1; int index = -1; Random rnd = new Random(); if (test == Attitude.Belligerent) { int[] attitudes = { 0, 2 }; index = rnd.Next(attitudes.Length); result = attitudes[index]; Console.WriteLine(result); } else if (test == Attitude.Kindly) { int[] attitudes = { 2, 4 }; index = rnd.Next(attitudes.Length); result = attitudes[index]; } closeAttitude = (Attitude)result; for (int i = 0; i < m_Atts.Length; i++) { if (m_Atts[i] == closeAttitude) { string str = null; for (int s = 0; s < m_Strings.Length && str == null; s++) { str = m_Strings[s].GetString(npc, pc); } return(str); } } return(null); }
public ActionResult DeleteConfirmed(int id) { Attitude attitude = db.Attitudes.Find(id); db.Attitudes.Remove(attitude); db.SaveChanges(); return(RedirectToAction("Index")); }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); mousePosition = e.Location; cameraAttitude = camera.Attitude; cameraPosition = camera.Position; }
/// <summary> /// Constructor for the Driver class. Creates a new Driver object with the specified values /// </summary> /// <param name="personality">Enum value indicating the defensiveness/ aggressiveness of a Driver</param> /// <param name="speed">Enum value indicating the speed preference of a Driver</param> /// <param name="attitude">Enum value indicating whether a Driver is calmer or angrier</param> /// <param name="leftLaneOnly">Boolean value whether the Driver only drives in the left lane</param> /// <param name="speedFluctuates">Boolean value whether the Driver's speed fluctuates</param> public Driver(PassingPersonality personality, Speed speed, Attitude attitude, bool leftLaneOnly = false, bool speedFluctuates = false) { Personality = personality; Speed = speed; Attitude = attitude; LeftLaneOnly = leftLaneOnly; SpeedFluctuates = speedFluctuates; }
public async Task Send(Attitude a) { var data = string.Format(CultureInfo.InvariantCulture, "XATT{0},{1:0.#},{2:0.#},{3:0.#},,,,,,,,,", // Garmin Pilot requires 13 fields SimId, a.TrueHeading, -a.Pitch, -a.Bank); await Send(data).ConfigureAwait(false); }
public void AddAttitude(GameObject subject, float weight, bool liking) { Attitude a = new Attitude(); a.subject = subject; a.weight = weight; a.liking = liking; attitudes.Add(a); }
internal void WorsenAttitude(int howMuch) { Attitude -= 2; if (Attitude < 0) { Attitude = 0; } Session.Self.AttitudeChanges.Add(new AttitudeChange(Name, false, Attitude)); }
public string GetString(BaseConvo npc, Mobile pc) { Attitude test = npc.Attitude; int iat = (int)npc.Attitude; if (pc.Fame > 4000) { iat++; if (pc.Fame > 9000) { iat++; } } if (iat >= 4) { test = Attitude.Goodhearted; } else if (iat <= 0) { test = Attitude.Wicked; } else { test = (Attitude)iat; } while (true) { for (int i = 0; i < m_Atts.Length; i++) { if (m_Atts[i] == test) { string str = null; for (int s = 0; s < m_Strings.Length && str == null; s++) { str = m_Strings[s].GetString(npc, pc); } return(str); } } if (test < Attitude.Neutral) { test = (Attitude)(((int)test) + 1); } else if (test > Attitude.Neutral) { test = (Attitude)(((int)test) - 1); } else { break; } } return(null); }
/// <summary> /// Initializes a new instance of the <see cref="DiplomaticTie"/> class. /// </summary> /// <param name="parentCountry"></param> /// <param name="foreignCountry"></param> public DiplomaticTie(Country parentCountry, Country foreignCountry) { this.parentCountry = parentCountry; this.foreignCountry = foreignCountry; this.attitude = Attitude.Cautious; this.currentTrades = new ArrayList(); this.diplomaticAgreements = new Collection <DiplomaticAgreement>(); this.diplomaticState = DiplomaticState.Peace; }
public Car(string name, string meshFile, Vector3 offset, Attitude adjust) : base(name, meshFile, offset, adjust) { m_dynamics = new CarDynamics(); // start the engine // m_dynamics.Gear = CarDynamics.GearState.Park; m_dynamics.Ignition = CarDynamics.IgnitionState.IgnitionStart; m_dynamics.Gear = CarDynamics.GearState.Drive; }
public async Task <IActionResult> Vote(Attitude Vote, int CommentId) { var user = await userManager.GetUserAsync(this.User); await commentService.SetUserAttitudeAsync(Vote, CommentId, user); int?productId = await commentService.GetProduct(CommentId); return(RedirectToAction("GoToProductDetails", new { productId = productId.Value })); }
public static AttitudeDTO createAttitudeDTO(Attitude source) { if (null == source) { return(null); } AttitudeDTO result = new AttitudeDTO(); Utilities.CopySimilar.CopyAll(source, result); return(result); }
public void set_attitude(Attitude attitude) { if (attitude == Attitude.WALKING) { anim.SetBool("is_walking", true); anim.SetBool("is_falling", false); anim.SetBool("is_floating", false); anim.SetBool("is_mining", false); anim.SetBool("is_building", false); } else if (attitude == Attitude.FALLING) { anim.SetBool("is_walking", false); anim.SetBool("is_falling", true); anim.SetBool("is_floating", false); } else if (attitude == Attitude.FLOATING) { anim.SetBool("is_walking", false); anim.SetBool("is_floating", true); } else if (attitude == Attitude.FLYING) { anim.SetBool("is_walking", false); anim.SetBool("is_falling", false); anim.SetBool("is_flying", true); } else if (attitude == Attitude.STANDING) { anim.SetBool("is_walking", false); anim.SetBool("is_falling", false); anim.SetBool("is_floating", false); } else if (attitude == Attitude.BUILDING) { anim.SetBool("is_walking", false); anim.SetBool("is_falling", false); anim.SetBool("is_floating", false); anim.SetBool("is_building", true); anim.SetBool("is_mining", false); } else if (attitude == Attitude.MINING) { anim.SetBool("is_walking", false); anim.SetBool("is_falling", false); anim.SetBool("is_floating", false); anim.SetBool("is_building", false); anim.SetBool("is_mining", true); } else if (attitude == Attitude.DYING) { anim.SetBool("is_dying", true); } }
private void onCueChange(Attitude cue, bool state) { if (state) { CFG.AT.XOnIfNot(cue); } else { CFG.AT.XOffIfOn(cue); } }
public ActionResult Edit([Bind(Include = "AttitudeID,HouseholdID,WashingMachine,Dishwasher,WashingLow,DishwashLow,WashingEff,DishwasherEff,Kettle,TapsOff,WashingBowl,RinsingBowl,TapsFlow,NoKitchen,OtherKitchen,NoFlush,LowFlush,CDD,LowShower,TapsOffBrush,ShowersNotBaths,LessBathWater,ShorterShowers,TapsFlowBath,NoBathroom,OtherBath,WaterButt,WaterCan,NoHosepipe,NoWaterLawn,NoGarden,OtherGarden,UpdateDate")] Attitude attitude) { if (ModelState.IsValid) { db.Entry(attitude).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.HouseholdID = new SelectList(db.Households, "HouseholdID", "WPnumber", attitude.HouseholdID); return(View(attitude)); }
public void Delete(long AttitudeID) { Attitude attitudeToDelete = (from attitude in DatabaseModel.Attitude where attitude.AttitudeID == AttitudeID select attitude).First(); //Delete Attitude Definitions using (AttitudeDefinitionController attitudeDefinitionController = new AttitudeDefinitionController(DatabasePath)) attitudeDefinitionController.DeleteAll(AttitudeID); DatabaseModel.Attitude.Remove(attitudeToDelete); DatabaseModel.SaveChanges(); }
public IObservable <Unit> SetAttitude(Attitude attitude) { return(Observable.Create <Unit>(observer => { var request = new SetAttitudeRequest(); request.Attitude = attitude; _offboardServiceClient.SetAttitude(request); observer.OnCompleted(); return Task.FromResult(Disposable.Empty); })); }
float weight = 0.5f; //default #endregion Fields #region Methods public override void OnInspectorGUI() { //Add new goals Goal gl = new Goal(); GUILayout.Label("Goals", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); pleased = EditorGUILayout.Toggle("Pleased", pleased); gl.pleased = pleased; conseqForSelf = EditorGUILayout.Toggle("ConsequenceForSelf", conseqForSelf, GUILayout.ExpandWidth(true)); gl.consequenceForSelf = conseqForSelf; if(conseqForSelf == false) { desirable = EditorGUILayout.Toggle("DesirableForOther", desirable, GUILayout.ExpandWidth(true)); gl.desirableForOther = desirable; } else { prospectRel = EditorGUILayout.Toggle("ProspectRelevant", prospectRel, GUILayout.ExpandWidth(true)); gl.prospectRelevant = prospectRel; gl.confirmed = AppDef.Unconfirmed; } EditorGUILayout.EndHorizontal(); weight = EditorGUILayout.Slider ("weight", weight, 0f, 1f, GUILayout.ExpandWidth(true)); gl.weight = weight; if(GUILayout.Button("Add Goal", GUILayout.ExpandWidth(false))) appraisal.goals.Add(gl); if(appraisal.goals.Count > 0) { EditorGUILayout.Separator(); GUI.contentColor = Color.yellow; GUILayout.Label("Current goals", EditorStyles.boldLabel); checkAllGoals = EditorGUILayout.Toggle("Check all", checkAllGoals); } foreach(Goal g in appraisal.goals) { EditorGUILayout.BeginHorizontal(); g.selected= EditorGUILayout.Toggle(g.selected, GUILayout.ExpandWidth(false)); if(g.pleased) GUILayout.Label ("Pleased"); else GUILayout.Label ("Displeased"); if(g.consequenceForSelf) { GUILayout.Label ("ConsequenceForSelf"); if(g.prospectRelevant) { GUILayout.Label ("ProspectRelevant"); if(g.confirmed == AppDef.Confirmed) GUILayout.Label ("Confirmed"); else if(g.confirmed == AppDef.Disconfirmed) GUILayout.Label ("Disconfirmed"); else GUILayout.Label ("Unconfirmed"); } else GUILayout.Label ("ProspectIrrelevant"); } else { GUILayout.Label ("ConsequenceForOther"); if(g.desirableForOther) GUILayout.Label ("Desirable"); else GUILayout.Label ("Unesirable"); } GUILayout.Label ("weight: " + g.weight); EditorGUILayout.EndHorizontal (); } if(checkAllGoals) foreach(Goal g in appraisal.goals) g.selected = true; if(appraisal.goals.Count > 0) { EditorGUILayout.Separator(); if(GUILayout.Button("RemoveChecked", GUILayout.ExpandWidth(false))) { int i = 0; while(i < appraisal.goals.Count) { if(appraisal.goals[i].selected){ appraisal.goals.Remove(appraisal.goals[i]); } else i++; } } } EditorGUILayout.Separator(); EditorGUILayout.Separator(); GUI.contentColor = Color.white; GUILayout.Label("Standards", EditorStyles.boldLabel); Standard st = new Standard(); EditorGUILayout.BeginHorizontal(); approving = EditorGUILayout.Toggle("Approving", approving); st.approving = approving; focOnSelf = EditorGUILayout.Toggle("Focusing on Self", focOnSelf, GUILayout.ExpandWidth(true)); st.focusingOnSelf = focOnSelf; EditorGUILayout.EndHorizontal(); weight = EditorGUILayout.Slider ("weight", weight, 0f, 1f, GUILayout.ExpandWidth(true)); st.weight = weight; if(GUILayout.Button("Add Standard", GUILayout.ExpandWidth(false))) appraisal.standards.Add(st); if(appraisal.standards.Count > 0) { EditorGUILayout.Separator(); GUI.contentColor = Color.yellow; GUILayout.Label("Current standards", EditorStyles.boldLabel); checkAllStandards = EditorGUILayout.Toggle("Check all", checkAllStandards); } foreach(Standard s in appraisal.standards) { EditorGUILayout.BeginHorizontal(); s.selected= EditorGUILayout.Toggle(s.selected, GUILayout.ExpandWidth(false)); if(s.approving) GUILayout.Label ("Approving"); else GUILayout.Label ("Disapproving"); if(s.focusingOnSelf) GUILayout.Label ("FocusingOnSelf"); else GUILayout.Label ("FocusingOnOther"); GUILayout.Label ("weight: " + s.weight); EditorGUILayout.EndHorizontal (); } if(checkAllStandards) foreach(Standard s in appraisal.standards) s.selected = true; if(appraisal.standards.Count > 0) { EditorGUILayout.Separator(); if(GUILayout.Button("RemoveChecked", GUILayout.ExpandWidth(false))) { int i = 0; while(i < appraisal.standards.Count) { if(appraisal.standards[i].selected){ appraisal.standards.Remove(appraisal.standards[i]); } else i++; } } } EditorGUILayout.Separator(); EditorGUILayout.Separator(); GUI.contentColor = Color.white; GUILayout.Label("Attitudes", EditorStyles.boldLabel); Attitude at = new Attitude(); EditorGUILayout.BeginHorizontal(); liking = EditorGUILayout.Toggle("Liking", liking); at.liking = liking; EditorGUILayout.EndHorizontal(); weight = EditorGUILayout.Slider ("weight", weight, 0f, 1f, GUILayout.ExpandWidth(true)); at.weight = weight; if(GUILayout.Button("Add Attitude", GUILayout.ExpandWidth(false))) appraisal.attitudes.Add(at); EditorGUILayout.Separator(); if(appraisal.attitudes.Count > 0) { EditorGUILayout.Separator(); GUI.contentColor = Color.yellow; GUILayout.Label("Current attitudes", EditorStyles.boldLabel); checkAllAttitudes = EditorGUILayout.Toggle("Check all", checkAllAttitudes); } foreach(Attitude a in appraisal.attitudes) { EditorGUILayout.BeginHorizontal(); a.selected= EditorGUILayout.Toggle(a.selected, GUILayout.ExpandWidth(false)); if(a.liking) GUILayout.Label ("Liking"); else GUILayout.Label ("Disliking"); GUILayout.Label ("weight: " + a.weight); EditorGUILayout.EndHorizontal (); } if(checkAllAttitudes) foreach(Attitude a in appraisal.attitudes) a.selected = true; GUI.contentColor = Color.white; if(appraisal.attitudes.Count > 0) { EditorGUILayout.Separator(); if(GUILayout.Button("RemoveChecked", GUILayout.ExpandWidth(false))) { int i = 0; while(i < appraisal.attitudes.Count) { if(appraisal.attitudes[i].selected){ appraisal.attitudes.Remove(appraisal.attitudes[i]); } else i++; } } } EditorUtility.SetDirty (target); }
protected override void DrawThis() { GUILayout.BeginHorizontal(); if(Edit) { Edit &= !GUILayout.Button(Name, Styles.active_button, GUILayout.ExpandWidth(false)); if(GUILayout.Button(attitude.ToString(), Styles.normal_button, GUILayout.ExpandWidth(false))) attitude = (Attitude)(((int)attitude+1)%10); } else Edit |= GUILayout.Button(Name+": "+attitude, Styles.normal_button); GUILayout.EndHorizontal(); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 0: { m_Job = (JobFragment)reader.ReadShort(); m_Mood = (Attitude)reader.ReadByte(); m_Soph = (Sophistication)reader.ReadByte(); break; } } }
public BaseConvo(AIType ai, FightMode mode, int iRangePerception, int iRangeFight, double dActiveSpeed, double dPassiveSpeed) : base(ai, mode, iRangePerception, iRangeFight, dActiveSpeed, dPassiveSpeed) { m_Job = JobFragment.None; if (this.AlwaysMurderer) m_Mood = (Attitude)Utility.Random(3); // make them never good tempered else m_Mood = (Attitude)Utility.Random(5); m_Soph = (Sophistication)Utility.Random(3); }