public bool Freeze() { _frozenLock.EnterUpgradeableReadLock(); try { if (_frozen) { return(false); } _frozenLock.EnterWriteLock(); try { _frozen = true; _frozenAt = OriginalClock.Time; } finally { _frozenLock.ExitWriteLock(); } } finally { _frozenLock.ExitUpgradeableReadLock(); } Frozen?.Invoke(this, EventArgs.Empty); return(true); }
protected void OnFrozen(CauseOfFreezing cause) { FreezeEventArgs args = new FreezeEventArgs(cause); Frozen?.Invoke(this, args); pauseSymbol.BeginAnimation(Canvas.OpacityProperty, pauseAnimation); pauseDisplay.Visibility = Visibility.Visible; }
public void RunEffects() { map.selectedEnemy = this.name; GameObject effects = GameObject.Find("Effects"); if (Burned) { // map.selectedEnemy = this.name; // Burn burn = effects.GetComponent <Burn> (); burn.RunBurn(); } if (Slowed) { // map.selectedEnemy = this.name; // GameObject Slow = GameObject.Find ("_Scripts"); Slow slow = effects.GetComponent <Slow> (); slow.RunSlow(); } if (Poisoned) { // map.selectedEnemy = this.name; // GameObject Poison = GameObject.Find ("_Scripts"); Poison poison = effects.GetComponent <Poison> (); poison.RunPoison(); } if (Bleeding) { // map.selectedEnemy = this.name; // GameObject Bleed = GameObject.Find ("_Scripts"); Bleed bleed = effects.GetComponent <Bleed> (); bleed.RunBleed(); } if (Stunned) { // map.selectedEnemy = this.name; // GameObject Stun = GameObject.Find ("_Scripts"); Stun stun = effects.GetComponent <Stun> (); stun.RunStun(); } if (Chilled) { Chill chill = effects.GetComponent <Chill> (); chill.RunChill(); } if (Frozen) { Frozen frozen = effects.GetComponent <Frozen> (); frozen.RunFrozen(); } if (Blinded) { Blind blind = effects.GetComponent <Blind> (); blind.RunBlind(); } }
protected void cmdSave_ServerClick(object sender, System.EventArgs e) { ArrayList array = this.gridHelper.GetCheckedRows(); if (array == null || array.Count <= 0) { return; } if (!ValidateInput()) { return; } Frozen frozen = null; string unfrozenReason = this.txtUnfrozenCauseEdit.Text.Trim(); string userCode = this.GetUserCode(); try { ((SQLDomainDataProvider)this.DataProvider).PersistBroker.AutoCloseConnection = false; ((SQLDomainDataProvider)this.DataProvider).PersistBroker.OpenConnection(); this.DataProvider.BeginTransaction(); if (_OQCFacade == null) { _OQCFacade = new OQCFacade(this.DataProvider); } foreach (UltraGridRow row in array) { frozen = (Frozen)this.GetEditObject(row); if (frozen != null) { _OQCFacade.UnfreezeRCard(frozen, unfrozenReason, userCode); } } this.DataProvider.CommitTransaction(); this.txtUnfrozenCauseEdit.Text = string.Empty; } catch (Exception ex) { this.DataProvider.RollbackTransaction(); throw ex; } finally { ((SQLDomainDataProvider)this.DataProvider).PersistBroker.CloseConnection(); ((SQLDomainDataProvider)this.DataProvider).PersistBroker.AutoCloseConnection = true; } this.gridHelper.RequestData(); }
public StateBankAccount() { _confirmingIdentity = new ConfirmingIdentity(this); _accountActive = new AccountActive(this); _frozen = new Frozen(this); _closing = new Closing(this); _closed = new Closed(this); Balance = 0.0; _state = _confirmingIdentity; }
public void Handle(Frozen e) { using (var session = _store.OpenSession()) { var get = session.Load <Responses.Get>(e.AccountId); get.Frozen = true; session.SaveChanges(); _manager.Publish(get); } }
public void FreezeFor(float time) { Frozen f = gameObject.GetComponent <Frozen>(); if (f == null) { f = gameObject.AddComponent <Frozen>(); } f.thawTime = time; f.enabled = true; }
public void Handle(Frozen e) { _elastic.Update <Responses.Index, Object>(x => x .Id(e.AccountId) .Doc(new { Frozen = true }) .RetryOnConflict(3) .Refresh() ); var index = _elastic.Get <Responses.Index>(e.AccountId); _manager.Publish(index.Source); }
private void Awake() { _originalPosition = transform.position; _originalScale = transform.localScale; // Setting up references. _catcherParticleSystem.loop = false; groundCheck = transform.Find("groundCheck"); _trailRenderer = GetComponent <TrailRenderer>(); _rigidbody = GetComponent <Rigidbody2D>(); _frozen = GetComponent <Frozen>(); _characterAnimation = GetComponentInChildren <CharacterAnimation>(); }
private string[] FormatExportRecord(object obj) { Frozen frozen = (Frozen)obj; return(new string[] { frozen.RCard, frozen.ItemCode, frozen.MOCode, frozen.LotNo, frozen.FrozenReason, FormatHelper.ToDateString(frozen.FrozenDate), FormatHelper.ToTimeString(frozen.FrozenTime), frozen.FrozenBy }); }
// Use to process your families. protected override void onProcess(int familiesUpdateCount) { foreach (GameObject go in _frozen) { // Update cooldown Frozen frozen = go.GetComponent <Frozen>(); frozen.remainingTime -= Time.deltaTime; // Set Velocity to 0 go.GetComponent <Rigidbody>().velocity = Vector3.zero; if (frozen.remainingTime <= 0) { GameObjectManager.removeComponent(frozen); } } }
protected Infragistics.WebUI.UltraWebGrid.UltraGridRow GetGridRow(object obj) { Frozen frozen = (Frozen)obj; return(new Infragistics.WebUI.UltraWebGrid.UltraGridRow( new object[] { "false", frozen.RCard, frozen.ItemCode, frozen.MOCode, frozen.LotNo, frozen.LotSequence.ToString(), frozen.FrozenReason, FormatHelper.ToDateString(frozen.FrozenDate), FormatHelper.ToTimeString(frozen.FrozenTime), frozen.FrozenBy, frozen.FrozenSequence.ToString() })); }
public void EnableFrozenEffect(bool enable) { if (_DeathEffect != null) { return; } if (enable) { if (null == _Frozen) { _Frozen = EffectObjectPool.Get(this, EffectType.Frozen) as Frozen; } if (_Frozen != null) { _Frozen.Start(() => { if (_Frozen != null) { _CurEffectsMask |= _Frozen.Mask; } }); } } else { if (_Frozen != null) { _Frozen.Stop(); _CurEffectsMask &= ~_Frozen.Mask; _Frozen = null; } } var animations = GetComponentsInChildren <Animation>(); foreach (var v in animations) { if (null != v && v.enabled == enable) { v.enabled = !enable; } } }
static void Main(string[] args) { string filePath = @"C:\Users\opilane\samples"; string fileName = @"frozenl.txt"; string fullFilePath = Path.Combine(filePath, fileName); string[] linesFromfile = File.ReadAllLines(fullFilePath); FrozenList myFrozen = new FrozenList(); foreach (string line in linesFromfile) { string[] tempArray = line.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); string frozenName = tempArray[0]; string FrozenItem = tempArray[1]; myFrozen.AddFrozenToList(frozenName, FrozenItem); } Frozen.PrintAll(); }
public DynamicMaterialSystem() { foreach (GameObject go in _dynGO) { DynamicMaterial dynMat = go.GetComponent <DynamicMaterial>(); if (dynMat.type == EDynMat.HEALTH) { WithHealth healthComp = go.GetComponent <WithHealth>(); healthComp.maxHealth = healthComp.health; dynMat.percentage = healthComp.health / healthComp.maxHealth; } else if (dynMat.type == EDynMat.FREEZE) { Frozen comp = go.GetComponent <Frozen>(); dynMat.percentage = 0; if (comp) { dynMat.percentage = comp.remainingTime / comp.totalTime; } } else if (dynMat.type == EDynMat.B_Cell) { BCell comp = go.GetComponent <BCell>(); if (comp) { dynMat.percentage = comp.cooldown / comp.delay; } } foreach (Material mat in go.GetComponent <Renderer>().materials) { if (mat.name.Contains(dynMat.materialName) || go.GetComponent <Renderer>().materials.Length == 1) { mat.color = dynMat.startingColor; } } } }
// Use to process your families. protected override void onProcess(int familiesUpdateCount) { foreach (GameObject go in _dynGO) { DynamicMaterial dynMat = go.GetComponent <DynamicMaterial>(); if (dynMat.type == EDynMat.HEALTH) { WithHealth healthComp = go.GetComponent <WithHealth>(); dynMat.percentage = healthComp.health / healthComp.maxHealth; } else if (dynMat.type == EDynMat.FREEZE) { Frozen comp = go.GetComponent <Frozen>(); dynMat.percentage = 0; if (comp) { dynMat.percentage = comp.remainingTime / comp.totalTime; } } else if (dynMat.type == EDynMat.B_Cell) { BCell comp = go.GetComponent <BCell>(); if (comp) { dynMat.percentage = comp.cooldown / comp.delay; } } foreach (Material mat in go.GetComponent <Renderer>().materials) { if (mat.name.Contains(dynMat.materialName) || go.GetComponent <Renderer>().materials.Length == 1) { mat.color = Color.Lerp(dynMat.endingColor, dynMat.startingColor, dynMat.percentage); } } } }
public void OnRecycle() { if (OnRecycleCallback != null) { OnRecycleCallback(this); } _CurEffectsMask = 0; ChangeMaterials(); _LastEffectMask = 0; // if (_FadeEffect != null) // { // _FadeEffect.Stop(); // _FadeEffect = null; // } if (_DeathEffect != null) { _DeathEffect.Stop(); _DeathEffect = null; } foreach (var kv in _EntityRimEffectMap) { if (kv.Value != null) { kv.Value.Stop(); } } _EntityRimEffectMap.Clear(); if (_Frozen != null) { _Frozen.Stop(); _Frozen = null; } }
public void ApplyChill() { GameObject[] Enemies = GameObject.FindGameObjectsWithTag("Enemy"); foreach (GameObject enemyAi in Enemies) { BaseEnemy enemy = enemyAi.GetComponent <BaseEnemy> (); if (enemy.Recentlyhit && enemy.MovementSpeed > 0) { enemy.Chilled = true; enemy.ChillDuration = duration; enemy.MovementSpeed--; enemy.ChillCount++; if (enemy.ChillCount >= 2) { enemy.Chilled = false; enemy.ChillDuration = 0; enemy.ChillCount = 0; GameObject effects = GameObject.Find("Effects"); Frozen frozen = effects.GetComponent <Frozen> (); frozen.ApplyFrozen(); } } } }
public Event(DateTime ClockStart, DateTime ClockEnd, int ClockRunTime, System.Xml.Linq.XDocument XMLEvents, ref CrashHandler Crash) { ch = Crash; events = new Dictionary<string, List<EventItem>>(); clock = new PartyClock(ClockStart, ClockEnd, ClockRunTime); Util.ShowClock = true; sound = new Sound(true); text = new Text2D(); chess = new Chess(); sf = new Starfield(150); intro = new Intro(ref sound, ref text); outro = new Outro(ref sound); advent = new Advent(ref sound); birthday = new Birthday(ref sound, ref text, ref chess); xmas = new Christmas(ref sound); smurf = new Datasmurf(ref sound, ref text); // random dif = new Dif(ref chess, ref sound); // random fbk = new Fbk(ref sound); // random hw = new Halloween(ref chess, ref sound, 25); lucia = new Lucia(ref chess, ref sound); newyear = new NewYear(); richard = new RMS(ref sound, ref text); // random scroller = new Scroller(ref chess, ref sf, ref text); // random semla = new Semla(); sune = new SuneAnimation(ref sound, ref text); tl = new TurboLogo(ref sound, ref chess, (OpenGL.Util.SpringOrFall.Equals("Spring")? true:false)/*((ClockStart.Month >= 1 && ClockStart.Month <= 8)? false:true)*/ ); // vilken termin är det? jan till början av augusti VT, resten HT... random valentine = new Valentine(ref sound); wl = new WinLinux(ref chess); //random creators = new Self(ref sound); // random bb = new BB(ref sound); // random GM = new GummiBears(ref sound); NDay = new National(ref chess, ref sound); easter = new Easter(ref sound); hajk = new Hajk(ref sound); mid = new Midsummer(ref sound); vaf = new Vaffla(); wp = new Walpurgis(); crayfish = new CrayFish(); ts = new TeknatStyle(ref chess, ref sound, ref text); m = new Matrix(ref text); q = new Quiz(ref text, false, ref sound); talepsin = new Talespin(ref sound); cd = new ChipAndDale(ref sound, ref chess); nerd = new Nerdy(ref chess, ref sound); trex = new Trex(ref sound); sailormoon = new Sailormoon(ref sound,ref chess); gb = new GhostBusters(ref sound); zelda = new Zelda(ref sound, ref chess); tardis = new Tardis(ref sound); f**k = new F**k(ref sound, ref chess); silverFang = new SilverFang(ref sound); mt = new MoraT(ref sound); swine = new Swine(ref chess, ref text); tjall = new Tjall(ref chess, ref text); ronja = new Ronja(ref sound); emil = new Emil(ref sound); djungelboken = new Djungelboken(ref sound); fabbe = new Fabbe(ref sound); drink = new Drink(ref sound); frozen = new Frozen(ref sound); eventCurrent = null; // event item for events to be triggerd in clock_NewDate //randomEvent = new List<string>(new string[] { "starfield", "SuneAnimation", "TurboLogo", "Datasmurf", "WinLinux", "Scroller", "BB", "GummiBears", "TeknatStyle", "Matrix"}); randomEvent = new List<string>(new string[] { "starfield", "Nerdy", "Talespin", "Sailormoon", "GhostBusters", "Zelda", "Tardis", "F**k", "SilverFang", "MoraT" }); //new stuff List<UtilXML.EventData> ed = UtilXML.Loadeffectdata(); // TODO: Make a clean list with all events allowed to be used implement so that it is actaully usable instead of a switch at the bottom of this file. Dictionary<string, Effect> effects = new Dictionary<string, Effect>() { {"SuneAnimation", new Effect(sune, ed.Find(e => e.Name == "SuneAnimation"))}, {"Dif",new Effect(dif, ed.Find(e => e.Name == "Dif"))}, {"Fbk",new Effect(fbk, ed.Find(e => e.Name == "Fbk"))}, {"TurboLogo",new Effect(tl, ed.Find(e => e.Name == "TurboLogo"))}, {"Datasmurf", new Effect(smurf, ed.Find(e => e.Name == "Datasmurf"))}, {"RMS",new Effect(richard, ed.Find(e => e.Name == "RMS"))}, {"WinLinux",new Effect(wl, ed.Find(e => e.Name == "WinLinux"))}, {"Scroller",new Effect(scroller, ed.Find(e => e.Name == "Scroller"))}, {"Self",new Effect(creators, ed.Find(e => e.Name == "Self"))}, {"BB",new Effect(bb, ed.Find(e => e.Name == "BB"))}, {"GummiBears",new Effect(GM, ed.Find(e => e.Name == "GummiBears"))}, {"Hajk",new Effect(hajk, ed.Find(e => e.Name == "Hajk"))}, {"TeknatStyle",new Effect(ts, ed.Find(e => e.Name == "TeknatStyle"))}, {"Matrix",new Effect(m, ed.Find(e => e.Name == "Matrix"))}, {"Quiz",new Effect(q, ed.Find(e => e.Name == "Quiz"))}, {"Talespin",new Effect(talepsin, ed.Find(e => e.Name == "Talespin"))}, {"ChipDale",new Effect(cd, ed.Find(e => e.Name == "ChipDale"))}, {"Nerdy",new Effect(nerd, ed.Find(e => e.Name == "Nerdy"))}, /* {"Trex",new Effect(trex, ed.Find(e => e.Name == "Trex"))},*/ {"Sailormoon",new Effect(sailormoon, ed.Find(e => e.Name == "Sailormoon"))}, {"GhostBusters",new Effect(gb, ed.Find(e => e.Name == "GhostBusters"))}, {"Zelda",new Effect(zelda, ed.Find(e => e.Name == "Zelda"))}, {"Tardis",new Effect(tardis, ed.Find(e => e.Name == "Tardis"))}, {"F**k",new Effect(f**k, ed.Find(e => e.Name == "F**k"))}, {"SilverFang",new Effect(silverFang, ed.Find(e => e.Name == "SilverFang"))}, {"MoraT",new Effect(mt, ed.Find(e => e.Name == "MoraT"))}, {"Ronja",new Effect(ronja, ed.Find(e => e.Name == "Ronja"))}, {"Emil",new Effect(emil, ed.Find(e => e.Name == "Emil"))}, {"Djungelboken",new Effect(djungelboken, ed.Find(e => e.Name == "Djungelboken"))}, {"Fabbe",new Effect(fabbe, ed.Find(e => e.Name == "Fabbe"))}, {"Drink",new Effect(drink, ed.Find(e => e.Name == "Drink"))}, {"Frozen",new Effect(drink, ed.Find(e => e.Name == "Frozen"))} }; runEffectInMonth = new Dictionary<string, List<objdata>>(); string[] months = Util.monthlist(); int counter; foreach (KeyValuePair<string, Effect> pair in effects) { counter = 0; foreach (bool b in pair.Value.RunAllowedlist) { if (b == true) { if (!runEffectInMonth.ContainsKey(months[counter])) { runEffectInMonth.Add(months[counter], new List<objdata>()); } runEffectInMonth[months[counter]].Add(new objdata(pair.Key, pair.Value.Vetolist[counter], pair.Value.Priolist[counter], pair.Value.Runslist[counter])); } counter++; } } clock.NewDate += clock_NewDate; // Event listener if (ch.CrashDialogResult == System.Windows.Forms.DialogResult.Yes) { clock.clock = ch.CrashClock; } string name, date, type; // Event dates setup foreach (var item in XMLEvents.Descendants("event")) { name = item.Element("name").Value; date = item.Element("date").Value; type = item.Element("type").Value.ToLower(); EventItem ei = new EventItem(name, type, date); if (!events.ContainsKey(date)) { List<EventItem> list = new List<EventItem>(); // seems most bad in my eyes... events.Add(date, list); } for (int i = 0; i < events[date].Count; i++) { EventItem e = events[date][i]; if ("birthday".Equals(e.Type) && "birthday".Equals(ei.Type)) { e.Name += "\n\n" + ei.Name; events[date][i] = e; } } events[date].Add(ei); name = date = type = string.Empty; } // this needs to be fixed nicer... if (events.ContainsKey(ClockEnd.ToShortDateString())) { events[ClockEnd.ToShortDateString()].Clear(); // force this to be top.. events[ClockEnd.ToShortDateString()].Add( new EventItem("outro", "outro", ClockEnd.ToShortDateString()) ); } else { events.Add(ClockEnd.ToShortDateString(), new List<EventItem>() { new EventItem("outro", "outro", ClockEnd.ToShortDateString()) }); } // Random effects on dates with no effects and check against new list of allowed things for them... DateTime dt = ClockStart; bool star = (Util.Rnd.Next(0, 1000) < 500 ? true:false); // make this random at the start too? int num = 0; while (dt <= ClockEnd) { date = dt.ToShortDateString(); if (!events.ContainsKey(date)) { EventItem ei; if (num == 0 || num == 1) { ei = new EventItem("starfield", "random", date); } else { //ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date); string month = ""; if (dt != null) month = dt.Month.ToString(); switch (month) { case "1": month = "jan"; break; case "2": month = "feb"; break; case "3": month = "mar"; break; case "4": month = "apr"; break; case "5": month = "maj"; break; case "6": month = "jun"; break; case "7": month = "jul"; break; case "8": month = "aug"; break; case "9": month = "sep"; break; case "10": month = "okt"; break; case "11": month = "nov"; break; case "12": month = "dec"; break; }//switch if (runEffectInMonth.ContainsKey(month)) { List<objdata> mobj = runEffectInMonth[month]; List<objdata> vetolist = new List<objdata>(); List<objdata> novetolist = new List<objdata>(); foreach (objdata n in mobj) { if ("Quiz".Equals(n.Name) && eventnum == 4) { n.vetoAgain(); eventnum = 0; } if (n.Veto == true) { if (n.Runs > 0) vetolist.Add(n); } else { if (n.Runs > 0) novetolist.Add(n); } } vetolist.Sort(); novetolist.Sort(); if (vetolist.Count > 0) { ei = new EventItem(vetolist[0].Name, "random", date); vetolist[0].noMoreVeto(); } else if (novetolist.Count > 0) { ei = new EventItem(novetolist[0].Name, "random", date); novetolist[0].decRuns(); if (eventnum < 4) eventnum++; } else { ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date); } } else { ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date); } } num++; if (num == 3) { num = 0; } ei = new EventItem("Self", "random", date); // this is for debuging new events events.Add(date, new List<EventItem>()); events[date].Add(ei); } dt = dt.AddDays(1); date = string.Empty; } }
public Messages GenerateLot(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect"); dataCollectDebug.WhenFunctionIn(messages); try { string itemCode = actionEventArgs.ProductInfo.NowSimulation.ItemCode; string rCard = actionEventArgs.ProductInfo.NowSimulation.RunningCard; string moCode = actionEventArgs.ProductInfo.NowSimulation.MOCode; ItemFacade itemFacade = new ItemFacade(this.DataProvider); BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider); OQCFacade oqcFacade = new OQCFacade(this.DataProvider); object item = itemFacade.GetItem(itemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID); if (item == null) { messages.Add(new Message(MessageType.Error, "$Error_ItemCode_NotExist $Domain_ItemCode=" + itemCode)); return(messages); } //if (((Item)item).CheckItemOP == null || ((Item)item).CheckItemOP.Trim().Length == 0) //{ // messages.Add(new Message(MessageType.Error, "$Error_NoItemGenerateLotOPCode $Domain_ItemCode=" + itemCode)); // return messages; //} DBDateTime currentDBDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); OQCLot lot; // Resource auto generate lotno for ReworkSheet Resource res = actionEventArgs.ProductInfo.Resource; if (res == null) { res = (Resource)baseModelFacade.GetResource(actionEventArgs.ResourceCode); actionEventArgs.ProductInfo.Resource = res; } ReworkFacade reworkFacade = new ReworkFacade(this.DataProvider); ReworkRange reworkRange = null; OQCLot currentLot = (OQCLot)oqcFacade.GetLatestOQCLot(actionEventArgs.RunningCard); if (currentLot != null && currentLot.LOTStatus == OQCLotStatus.OQCLotStatus_Reject) { reworkRange = (ReworkRange)reworkFacade.GetLatestReworkRange(actionEventArgs.RunningCard); } //产生新批的情况有两种 //情况一:返工Res(Res.ReworkRouteCode不为空),RCard有当前的返工需求单,且此返工需求单要求自动产生新批(ReworkSheet.AutoLot等于Y) //情况二:其他情况,当前工序为Item的产生批工序(当前工序等于Item.CheckItemOP) // if (res != null && res.ReworkRouteCode != null && res.ReworkRouteCode.Trim().Length > 0 && reworkRange != null && reworkRange.ReworkCode != null && reworkRange.ReworkCode.Trim().Length > 0) { object reworkSheet = reworkFacade.GetReworkSheet(reworkRange.ReworkCode); ReworkSheet rs = reworkSheet as ReworkSheet; if (rs.AutoLot != null && string.Compare(rs.AutoLot, "Y", true) == 0 && rs.LotList != null && rs.LotList.Trim().Length > 0) { //Get rework lot by oldlotno (reworkcode=oldlotno=lotlist) object rLot = oqcFacade.GetOQCLotByOldLotNo(rs.LotList); if (rLot == null) { lot = this.CreateNewLot(actionEventArgs, (Item)item, currentDBDateTime, true, rs.LotList); } else { lot = rLot as OQCLot; } } else { return(messages); } } else { if (string.Compare(((Item)item).CheckItemOP, actionEventArgs.ProductInfo.NowSimulation.OPCode, true) != 0) { return(messages); } // GetLot2Card By RCard+LotStatus if (oqcFacade.IsCardUsedByAnyLot(rCard, moCode, itemCode)) { return(messages); } else { lot = this.CreateNewLot(actionEventArgs, (Item)item, currentDBDateTime, false, ""); } } object oldLot2Card = oqcFacade.GetOQCLot2Card(actionEventArgs.ProductInfo.NowSimulation.RunningCard, actionEventArgs.ProductInfo.NowSimulation.MOCode, lot.LOTNO, lot.LotSequence); if (oldLot2Card != null) { //messages.Add(new Message(MessageType.Error, "$Error_IDHasExistedInOtherOQCLotNO $CS_LotNo=" + lot.LOTNO)); return(messages); } actionEventArgs.ProductInfo.NowSimulation.LOTNO = lot.LOTNO; actionEventArgs.ProductInfo.NowSimulationReport.LOTNO = lot.LOTNO; DataCollectFacade dataCollect = new DataCollectFacade(this.DataProvider); dataCollect.UpdateSimulation(actionEventArgs.ProductInfo.NowSimulation); dataCollect.UpdateSimulationReport(actionEventArgs.ProductInfo.NowSimulationReport); OQCLot2Card oqcLot2Card = oqcFacade.CreateNewOQCLot2Card(); oqcLot2Card.ItemCode = actionEventArgs.ProductInfo.NowSimulation.ItemCode; oqcLot2Card.CollectType = "pcs"; oqcLot2Card.LOTNO = lot.LOTNO; oqcLot2Card.LotSequence = OQCFacade.Lot_Sequence_Default; oqcLot2Card.MaintainUser = actionEventArgs.UserCode; oqcLot2Card.MaintainDate = currentDBDateTime.DBDate; oqcLot2Card.MaintainTime = currentDBDateTime.DBTime; oqcLot2Card.MOCode = actionEventArgs.ProductInfo.NowSimulation.MOCode; oqcLot2Card.ModelCode = actionEventArgs.ProductInfo.NowSimulation.ModelCode; oqcLot2Card.OPCode = actionEventArgs.ProductInfo.NowSimulation.OPCode; oqcLot2Card.ResourceCode = actionEventArgs.ProductInfo.NowSimulation.ResourceCode; oqcLot2Card.RouteCode = actionEventArgs.ProductInfo.NowSimulation.RouteCode; oqcLot2Card.RunningCard = actionEventArgs.ProductInfo.NowSimulation.RunningCard; oqcLot2Card.RunningCardSequence = actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence; oqcLot2Card.SegmnetCode = actionEventArgs.ProductInfo.NowSimulationReport.SegmentCode; oqcLot2Card.ShiftCode = actionEventArgs.ProductInfo.NowSimulationReport.ShiftCode; oqcLot2Card.ShiftTypeCode = actionEventArgs.ProductInfo.NowSimulationReport.ShiftTypeCode; oqcLot2Card.Status = actionEventArgs.ProductInfo.NowSimulationReport.Status; oqcLot2Card.StepSequenceCode = actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode; oqcLot2Card.TimePeriodCode = actionEventArgs.ProductInfo.NowSimulationReport.TimePeriodCode; //oqcLot2Card.EAttribute1 = actionEventArgs.ProductInfo.NowSimulation.CartonCode; oqcLot2Card.EAttribute1 = ""; //现在这里只能是空,后面Carton包装时候会更新为CartonCode oqcLot2Card.MOSeq = actionEventArgs.ProductInfo.NowSimulation.MOSeq; oqcFacade.AddOQCLot2Card(oqcLot2Card); // Added By Hi1/Venus.Feng on 20081027 for Hisense Version : Add Frozen by lot logic if (lot.FrozenStatus == FrozenStatus.STATUS_FRONZEN) { Frozen frozen = new Frozen(); frozen.RCard = actionEventArgs.ProductInfo.NowSimulation.RunningCard; frozen.EAttribute1 = ""; frozen.FrozenBy = lot.FrozenBy; frozen.FrozenDate = lot.FrozenDate; frozen.FrozenReason = lot.FrozenReason; int seq = 0; object[] oldFrozenRCard = oqcFacade.QueryFrozen(frozen.RCard, frozen.RCard, string.Empty, string.Empty, string.Empty, string.Empty, -1, -1, -1, -1, int.MinValue, int.MaxValue); if (oldFrozenRCard != null) { foreach (Frozen f in oldFrozenRCard) { seq = Math.Max(seq, f.FrozenSequence); } } frozen.FrozenSequence = seq + 1; frozen.FrozenStatus = FrozenStatus.STATUS_FRONZEN; frozen.FrozenTime = lot.FrozenTime; frozen.ItemCode = actionEventArgs.ProductInfo.NowSimulation.ItemCode; frozen.LotNo = lot.LOTNO; frozen.LotSequence = Convert.ToInt32(lot.LotSequence); frozen.MaintainDate = currentDBDateTime.DBDate; frozen.MaintainTime = currentDBDateTime.DBTime; frozen.MaintainUser = actionEventArgs.UserCode; frozen.MOCode = actionEventArgs.ProductInfo.NowSimulation.MOCode; frozen.ModelCode = actionEventArgs.ProductInfo.NowSimulation.ModelCode; frozen.UnfrozenBy = ""; frozen.UnfrozenDate = 0; frozen.UnfrozenReason = ""; frozen.UnfrozenTime = 0; oqcFacade.AddFrozen(frozen); } // End Added //Update tbloqclot.lotsize++ lot.LotSize = 1; oqcFacade.UpdateOQCLotSize(lot); } catch (Exception ex) { messages.Add(new Message(ex)); } dataCollectDebug.WhenFunctionOut(messages); return(messages); }
public void AddCharactersToList(string character, string wish) { Frozen newChar = new Frozen(character, wish); characters.Add(newChar); }
/// <summary> /// Draws the inspector for the pack /// </summary> /// <returns></returns> public static bool OnPackInspector(MotionController rMotionController) { EditorHelper.DrawSmallTitle(GroupName()); EditorHelper.DrawLink("Mixamo Pro Magic Pack Animations", "http://www.ootii.com/Unity/MotionPacks/SpellCasting/SpellCastingUsersGuide.pdf"); GUILayout.Space(5f); EditorGUILayout.LabelField("See included documentation:", EditorHelper.SmallBoldLabel); EditorGUILayout.LabelField("1. Download and import animations.", EditorHelper.SmallLabel); EditorGUILayout.LabelField("2. Unzip and replace animation meta files.", EditorHelper.SmallLabel); EditorGUILayout.LabelField("3. Select options and create motions.", EditorHelper.SmallLabel); EditorHelper.DrawLine(); EditorHelper.BoolField("Create Mecanim States", "Determines if we create/override the existing sub-state machine", sCreateSubStateMachines); sCreateSubStateMachines = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Input Aliases", "Determines if we create input aliases", sCreateInputAliases); sCreateInputAliases = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Inventory", "Determines if we create/override the existing inventory", sCreateInventory); sCreateInventory = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Attributes", "Determines if we create/override the existing attributes", sCreateAttributes); sCreateAttributes = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Spell Inventory", "Create the spell inventory for the caster", sCreateSpellInventory); sCreateSpellInventory = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Combatant", "Determines if we create/override the existing core", sCreateCore); sCreateCore = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Motions", "Determines if we create the archery motions", sCreateMotions); sCreateMotions = EditorHelper.FieldBoolValue; GUILayout.Space(5f); if (GUILayout.Button(new GUIContent("Setup Pack", "Create and setup the motion pack."), EditorStyles.miniButton)) { if (sCreateInventory) { BasicInventory lInventory = rMotionController.gameObject.GetComponent <BasicInventory>(); if (lInventory == null) { lInventory = rMotionController.gameObject.AddComponent <BasicInventory>(); } BasicInventoryItem lItem = lInventory.GetInventoryItem("Spell_01"); if (lItem != null) { lInventory.Items.Remove(lItem); } lInventory.Items.Add(new BasicInventoryItem()); lInventory.Items[lInventory.Items.Count - 1].ID = "Spell_01"; lInventory.Items[lInventory.Items.Count - 1].EquipMotion = "PMP_EquipSpell"; lInventory.Items[lInventory.Items.Count - 1].StoreMotion = "PMP_StoreSpell"; BasicInventorySlot lSlot = lInventory.GetInventorySlot("RIGHT_HAND"); if (lSlot == null) { lInventory.Slots.Add(new BasicInventorySlot()); lInventory.Slots[lInventory.Slots.Count - 1].ID = "RIGHT_HAND"; lInventory.Slots[lInventory.Slots.Count - 1].ItemID = ""; } if (lInventory.GetInventorySlot("LEFT_HAND") == null) { lInventory.Slots.Add(new BasicInventorySlot()); lInventory.Slots[lInventory.Slots.Count - 1].ID = "LEFT_HAND"; lInventory.Slots[lInventory.Slots.Count - 1].ItemID = ""; } lSlot = lInventory.GetInventorySlot("LEFT_LOWER_ARM"); if (lSlot == null) { lInventory.Slots.Add(new BasicInventorySlot()); lInventory.Slots[lInventory.Slots.Count - 1].ID = "LEFT_LOWER_ARM"; lInventory.Slots[lInventory.Slots.Count - 1].ItemID = ""; } if (lInventory.GetInventorySlot("READY_PROJECTILE") == null) { lInventory.Slots.Add(new BasicInventorySlot()); lInventory.Slots[lInventory.Slots.Count - 1].ID = "READY_PROJECTILE"; lInventory.Slots[lInventory.Slots.Count - 1].ItemID = ""; } BasicInventorySet lWeaponSet = lInventory.GetWeaponSet("Spell Casting"); if (lWeaponSet != null) { lInventory.WeaponSets.Remove(lWeaponSet); } lWeaponSet = new BasicInventorySet(); lWeaponSet.ID = "Spell Casting"; BasicInventorySetItem lWeaponSetItem = new BasicInventorySetItem(); lWeaponSetItem.ItemID = ""; lWeaponSetItem.SlotID = "LEFT_HAND"; lWeaponSetItem.Instantiate = true; lWeaponSet.Items.Add(lWeaponSetItem); lWeaponSetItem = new BasicInventorySetItem(); lWeaponSetItem.ItemID = ""; lWeaponSetItem.SlotID = "READY_PROJECTILE"; lWeaponSetItem.Instantiate = false; lWeaponSet.Items.Add(lWeaponSetItem); lWeaponSetItem = new BasicInventorySetItem(); lWeaponSetItem.ItemID = "Spell_01"; lWeaponSetItem.SlotID = "RIGHT_HAND"; lWeaponSetItem.Instantiate = false; lWeaponSet.Items.Add(lWeaponSetItem); lWeaponSetItem = new BasicInventorySetItem(); lWeaponSetItem.ItemID = ""; lWeaponSetItem.SlotID = "LEFT_LOWER_ARM"; lWeaponSetItem.Instantiate = false; lWeaponSet.Items.Add(lWeaponSetItem); if (lInventory.WeaponSets.Count == 0) { BasicInventorySet lFirstWeaponSet = new BasicInventorySet(); lFirstWeaponSet.ID = "Sword and Shield"; lInventory.WeaponSets.Add(lFirstWeaponSet); } if (lInventory.WeaponSets.Count == 1) { BasicInventorySet lSecondWeaponSet = new BasicInventorySet(); lSecondWeaponSet.ID = "Longbow"; lInventory.WeaponSets.Add(lSecondWeaponSet); } lInventory.WeaponSets.Insert(2, lWeaponSet); } if (sCreateAttributes) { BasicAttributes lAttributes = rMotionController.gameObject.GetComponent <BasicAttributes>(); if (lAttributes == null) { lAttributes = rMotionController.gameObject.AddComponent <BasicAttributes>(); } BasicAttribute lAttribute = lAttributes.GetAttribute("Health"); if (lAttribute != null) { lAttributes.Items.Remove(lAttribute); } lAttributes.Items.Add(new BasicAttribute()); lAttributes.Items[lAttributes.Items.Count - 1].ID = "Health"; lAttributes.Items[lAttributes.Items.Count - 1].SetValue <float>(100f); } if (sCreateSpellInventory) { SpellInventory lAttributes = rMotionController.gameObject.GetComponent <SpellInventory>(); if (lAttributes == null) { lAttributes = rMotionController.gameObject.AddComponent <SpellInventory>(); } } if (sCreateCore) { Combatant lCombatant = rMotionController.gameObject.GetComponent <Combatant>(); if (lCombatant == null) { lCombatant = rMotionController.gameObject.AddComponent <Combatant>(); } if (rMotionController._ActorController == null || !rMotionController._ActorController.UseTransformPosition) { lCombatant.IsLockingEnabled = true; lCombatant.TargetLockedIcon = AssetDatabase.LoadAssetAtPath <Texture>("Assets/ootii/Framework_v1/Content/Textures/UI/TargetIcon_2.png"); } ActorCore lCore = rMotionController.gameObject.GetComponent <ActorCore>(); if (lCore == null) { lCore = rMotionController.gameObject.AddComponent <ActorCore>(); } lCore.IsAlive = true; } if (sCreateInputAliases) { // Sheathe if (!InputManagerHelper.IsDefined("Spell Casting Equip")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Equip"; lEntry.PositiveButton = "3"; // "3" key lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Equip"; lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.JoyNum = 0; #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX lEntry.PositiveButton = "joystick button 8"; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; // D-pad Y lEntry.Axis = 0; #else lEntry.PositiveButton = ""; lEntry.Type = InputManagerEntryType.JOYSTICK_AXIS; // D-pad Y lEntry.Axis = 7; #endif InputManagerHelper.AddEntry(lEntry, true); } // Fire if (!InputManagerHelper.IsDefined("Spell Casting Cast")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Cast"; lEntry.PositiveButton = "left ctrl"; lEntry.AltPositiveButton = "mouse 0"; // Left mouse button lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Cast"; #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX lEntry.PositiveButton = "joystick button 16"; // Green A #else lEntry.PositiveButton = "joystick button 0"; // Green A #endif lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } // Continue if (!InputManagerHelper.IsDefined("Spell Casting Continue")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Continue"; lEntry.PositiveButton = "left ctrl"; lEntry.AltPositiveButton = "mouse 0"; // Left mouse button lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Continue"; #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX lEntry.PositiveButton = "joystick button 16"; // Green A #else lEntry.PositiveButton = "joystick button 0"; // Green A #endif lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } // Cancel if (!InputManagerHelper.IsDefined("Spell Casting Cancel")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Cancel"; lEntry.PositiveButton = "escape"; lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Cancel"; #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX lEntry.PositiveButton = "joystick button 19"; // Yellow Y #else lEntry.PositiveButton = "joystick button 3"; // Yellow Y #endif lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } // Move Up if (!InputManagerHelper.IsDefined("Move Up")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Move Up"; lEntry.PositiveButton = "e"; lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } // Move down if (!InputManagerHelper.IsDefined("Move Down")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Move Down"; lEntry.PositiveButton = "q"; lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } } if (sCreateMotions || sCreateSubStateMachines) { IBaseCameraRig lCameraRig = rMotionController.CameraRig; if (lCameraRig == null) { lCameraRig = rMotionController.ExtractCameraRig(rMotionController.CameraTransform); } if (rMotionController.MotionLayers.Count == 0) { MotionControllerLayer lMotionLayer = new MotionControllerLayer(); rMotionController.MotionLayers.Add(lMotionLayer); } PMP_Idle lIdle = rMotionController.GetMotion <PMP_Idle>(); if (lIdle == null) { lIdle = rMotionController.CreateMotion <PMP_Idle>(0); } PMP_EquipSpell lEquip = rMotionController.GetMotion <PMP_EquipSpell>(0); if (lEquip == null) { lEquip = rMotionController.CreateMotion <PMP_EquipSpell>(0); } PMP_StoreSpell lStore = rMotionController.GetMotion <PMP_StoreSpell>(0); if (lStore == null) { lStore = rMotionController.CreateMotion <PMP_StoreSpell>(0); } PMP_WalkRunPivot lPivot = rMotionController.GetMotion <PMP_WalkRunPivot>(0); if (lPivot == null) { lPivot = rMotionController.CreateMotion <PMP_WalkRunPivot>(0); } PMP_WalkRunStrafe lStrafe = rMotionController.GetMotion <PMP_WalkRunStrafe>(0); if (lStrafe == null) { lStrafe = rMotionController.CreateMotion <PMP_WalkRunStrafe>(0); } PMP_BasicSpellCastings lCast = rMotionController.GetMotion <PMP_BasicSpellCastings>(0); if (lCast == null) { lCast = rMotionController.CreateMotion <PMP_BasicSpellCastings>(0); } Cower lCower = rMotionController.GetMotion <Cower>(0); if (lCower == null) { lCower = rMotionController.CreateMotion <Cower>(0); } Death lDeath = rMotionController.GetMotion <Death>(0); if (lDeath == null) { lDeath = rMotionController.CreateMotion <Death>(0); } Damaged lDamaged = rMotionController.GetMotion <Damaged>(0); if (lDamaged == null) { lDamaged = rMotionController.CreateMotion <Damaged>(0); } Frozen lFrozen = rMotionController.GetMotion <Frozen>(0); if (lFrozen == null) { lFrozen = rMotionController.CreateMotion <Frozen>(0); } KnockedDown lKnockedDown = rMotionController.GetMotion <KnockedDown>(0); if (lKnockedDown == null) { lKnockedDown = rMotionController.CreateMotion <KnockedDown>(0); } Levitate lLevitate = rMotionController.GetMotion <Levitate>(0); if (lLevitate == null) { lLevitate = rMotionController.CreateMotion <Levitate>(0); } PushedBack lPushedBack = rMotionController.GetMotion <PushedBack>(0); if (lPushedBack == null) { lPushedBack = rMotionController.CreateMotion <PushedBack>(0); } Sleep lSleep = rMotionController.GetMotion <Sleep>(0); if (lSleep == null) { lSleep = rMotionController.CreateMotion <Sleep>(0); } Stunned lStunned = rMotionController.GetMotion <Stunned>(0); if (lStunned == null) { lStunned = rMotionController.CreateMotion <Stunned>(0); } if (sCreateSubStateMachines) { Animator lAnimator = rMotionController.Animator; if (lAnimator == null) { lAnimator = rMotionController.gameObject.GetComponent <Animator>(); } if (lAnimator != null) { UnityEditor.Animations.AnimatorController lAnimatorController = lAnimator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController; lIdle.CreateStateMachine(lAnimatorController); lEquip.CreateStateMachine(lAnimatorController); lPivot.CreateStateMachine(lAnimatorController); lStrafe.CreateStateMachine(lAnimatorController); lCast.CreateStateMachine(lAnimatorController); lDeath.CreateStateMachine(lAnimatorController); lLevitate.CreateStateMachine(lAnimatorController); } } } EditorUtility.DisplayDialog("Motion Pack: " + GroupName(), "Motion pack imported.", "ok"); return(true); } return(false); }
//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// void SpawnLootInGameWorld() { if (!gameManagerRef.deleteGame) { int randomChanse = Random.Range(0, 11); // Random chanse for call event //Debug.Log(randomChanse); if (randomChanse >= 3 && !gameManagerRef.playerRef.playerLostBubble) { int randomItem = Random.Range(0, 12); //Debug.Log(randomItem); //POISON if (randomItem == 7) { Poison tempLoot = Instantiate(poison_Loot).GetComponent <Poison>(); tempLoot.name = "Poison_Loot"; tempLoot.gameObject.SetActive(true); } //FROZEN if (randomItem == 6) { Frozen tempLoot = Instantiate(frozen_Loot).GetComponent <Frozen>(); tempLoot.name = "Frozen_Loot"; tempLoot.gameObject.SetActive(true); } //BOMB if (randomItem == 5) { Bomb tempLoot = Instantiate(bomb_Loot).GetComponent <Bomb>(); tempLoot.name = "Bomb_Loot"; tempLoot.gameObject.SetActive(true); } //LIGHTNING if (randomItem == 4) { Lightning tempLoot = Instantiate(lightning_Loot).GetComponent <Lightning>(); tempLoot.name = "Lightning_Loot"; tempLoot.gameObject.SetActive(true); } //COPY if (randomItem == 3) { Copy tempLoot = Instantiate(copy_Loot).GetComponent <Copy>(); tempLoot.name = "Copy_Loot"; tempLoot.gameObject.SetActive(true); } //SHIELD if (randomItem == 2) { Shield tempLoot = Instantiate(shield_Loot).GetComponent <Shield>(); tempLoot.name = "Shield_Loot"; tempLoot.gameObject.SetActive(true); } //LIFE if (randomItem == 1) { int chance50 = Random.Range(0, 10); if (chance50 >= 5) { Life tempLoot = Instantiate(life_Loot).GetComponent <Life>(); tempLoot.name = "Life_Loot"; tempLoot.gameObject.SetActive(true); } } } Invoke("LetPlayerMakeNextTurn", 0.75f); } }
private void FreezeHandler(object sender, PokemonEventArgs e) { Frozen?.Invoke(this, EventArgs); }
public override void OnInspectorGUI() { m_object.Update(); DrawDefaultInspector(); Frozen _2dxScript = (Frozen)target; //Texture2D icon = Resources.Load("2dxfxinspector-anim") as Texture2D; //if (icon) //{ // Rect r; // float ih = icon.height; // float iw = icon.width; // float result = ih / iw; // float w = Screen.width; // result = result * w; // r = GUILayoutUtility.GetRect(ih, result); // EditorGUI.DrawTextureTransparent(r, icon); //} EditorGUILayout.PropertyField(m_object.FindProperty("ActiveUpdate"), new GUIContent("Active Update", "Active Update, for animation / Animator only")); EditorGUILayout.PropertyField(m_object.FindProperty("ForceMaterial"), new GUIContent("Shared Material", "Use a unique material, reduce drastically the use of draw call")); if (_2dxScript.ForceMaterial == null) { _2dxScript.ActiveChange = true; } else { if (GUILayout.Button("Remove Shared Material")) { _2dxScript.ForceMaterial = null; _2dxScript.ShaderChange = 1; _2dxScript.ActiveChange = true; _2dxScript.CallUpdate(); } EditorGUILayout.PropertyField(m_object.FindProperty("ActiveChange"), new GUIContent("Change Material Property", "Change The Material Property")); } if (_2dxScript.ActiveChange) { EditorGUILayout.BeginVertical("Box"); Texture2D icone = Resources.Load("2dxfx-icon-time") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_Value1"), new GUIContent("Frozen Speed", icone, "Change the Frozen speed")); icone = Resources.Load("2dxfx-icon-brightness") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_Value2"), new GUIContent("Frozen Intensity", icone, "Change the Frozen light intensity")); EditorGUILayout.BeginVertical("Box"); icone = Resources.Load("2dxfx-icon-fade") as Texture2D; EditorGUILayout.PropertyField(m_object.FindProperty("_Alpha"), new GUIContent("Fading", icone, "Fade from nothing to showing")); EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); } m_object.ApplyModifiedProperties(); }
public override bool Validate() { if (this.contract == null) { throw new ContractValidateException("No contract!"); } if (this.db_manager == null) { throw new ContractValidateException("No this.db_manager!"); } if (this.contract.Is(UnfreezeBalanceContract.Descriptor)) { UnfreezeBalanceContract unfreeze_balance_contract = null; try { unfreeze_balance_contract = this.contract.Unpack <UnfreezeBalanceContract>(); } catch (InvalidProtocolBufferException e) { Logger.Debug(e.Message); throw new ContractValidateException(e.Message); } byte[] owner_address = unfreeze_balance_contract.OwnerAddress.ToByteArray(); if (!Wallet.IsValidAddress(owner_address)) { throw new ContractValidateException("Invalid address"); } AccountCapsule account = this.db_manager.Account.Get(owner_address); if (account == null) { throw new ContractValidateException( "Account[" + owner_address.ToHexString() + "] not exists"); } long now = this.db_manager.GetHeadBlockTimestamp(); byte[] receiver_address = unfreeze_balance_contract.ReceiverAddress.ToByteArray(); if (receiver_address != null && receiver_address.Length > 0 && this.db_manager.DynamicProperties.SupportDR()) { if (receiver_address.SequenceEqual(owner_address)) { throw new ContractValidateException("receiver_address must not be the same as owner_address"); } if (!Wallet.IsValidAddress(receiver_address)) { throw new ContractValidateException("Invalid receiver_address"); } AccountCapsule receiver = this.db_manager.Account.Get(receiver_address); if (receiver == null) { throw new ContractValidateException("Account[" + receiver_address.ToHexString() + "] not exists"); } byte[] key = DelegatedResourceCapsule.CreateDatabaseKey( unfreeze_balance_contract.OwnerAddress.ToByteArray(), unfreeze_balance_contract.ReceiverAddress.ToByteArray()); DelegatedResourceCapsule delegated_resource = this.db_manager.DelegatedResource.Get(key); if (delegated_resource == null) { throw new ContractValidateException("delegated Resource not exists"); } switch (unfreeze_balance_contract.Resource) { case ResourceCode.Bandwidth: { if (delegated_resource.FrozenBalanceForBandwidth <= 0) { throw new ContractValidateException("no delegatedFrozenBalance(BANDWIDTH)"); } if (receiver.AcquiredDelegatedFrozenBalanceForBandwidth < delegated_resource.FrozenBalanceForBandwidth) { throw new ContractValidateException( "AcquiredDelegatedFrozenBalanceForBandwidth[" + receiver.AcquiredDelegatedFrozenBalanceForBandwidth + "] < delegatedBandwidth[" + delegated_resource.FrozenBalanceForBandwidth + "],this should never happen"); } if (delegated_resource.ExpireTimeForBandwidth > now) { throw new ContractValidateException("It's not time to unfreeze."); } } break; case ResourceCode.Energy: { if (delegated_resource.FrozenBalanceForEnergy <= 0) { throw new ContractValidateException("no delegateFrozenBalance(Energy)"); } if (receiver.AcquiredDelegatedFrozenBalanceForEnergy < delegated_resource.FrozenBalanceForEnergy) { throw new ContractValidateException( "AcquiredDelegatedFrozenBalanceForEnergy[" + receiver.AcquiredDelegatedFrozenBalanceForEnergy + "] < delegatedEnergy[" + delegated_resource.FrozenBalanceForEnergy + "],this should never happen"); } if (delegated_resource.GetExpireTimeForEnergy(this.db_manager) > now) { throw new ContractValidateException("It's not time to unfreeze."); } } break; default: { throw new ContractValidateException("ResourceCode error.valid ResourceCode[BANDWIDTH、Energy]"); } } } else { switch (unfreeze_balance_contract.Resource) { case ResourceCode.Bandwidth: { if (account.FrozenCount <= 0) { throw new ContractValidateException("no frozenBalance(BANDWIDTH)"); } long unfreeze_count = account.FrozenList.Where(frozen => frozen.ExpireTime <= now).Count(); if (unfreeze_count <= 0) { throw new ContractValidateException("It's not time to unfreeze(BANDWIDTH)."); } } break; case ResourceCode.Energy: { Frozen frozen = account.AccountResource.FrozenBalanceForEnergy; if (frozen.FrozenBalance <= 0) { throw new ContractValidateException("no frozenBalance(Energy)"); } if (frozen.ExpireTime > now) { throw new ContractValidateException("It's not time to unfreeze(Energy)."); } } break; default: { throw new ContractValidateException("ResourceCode error.valid ResourceCode[BANDWIDTH、Energy]"); } } } } else { throw new ContractValidateException( "contract type error,expected type [UnfreezeBalanceContract],real type[" + contract.GetType().Name + "]"); } return(true); }
public void AddFrozenToList(string name, string item) { Frozen newFrozen = new Frozen(name, item); frozens.Add(newFrozen); }
public void AddFrozenToList(string name, string thing) { Frozen newFrozen = new Frozen(name, thing); characters.Add(newFrozen); }
public void Save(string Key) { bool found = false; string OutputFile = "./Database/Users/" + Name + "/Info.Dat"; Utilities.IO.PrepareDirectory("./Database/"); Utilities.IO.PrepareDirectory("./Database/Users/"); Utilities.IO.PrepareDirectory("./Database/Users/" + Name); Utilities.IO.PrepareFile(OutputFile); string[] OutputFileContents = Utilities.IO.ReadAllLines(OutputFile); string OutTime = Utilities.DateTimeUtilities.ToYearTimeDescending(Utilities.DateTimeUtilities.FormatDateTime(DateTime.Now)); List <String> Output = new List <String>(); foreach (string line in OutputFileContents) { #region GetDataCouplets string ThisLine = line; if (!(ThisLine.Contains("\t"))) { Output.Add(line); continue; } while (ThisLine.Contains("\t\t")) { ThisLine = ThisLine.Replace("\t\t", "\t"); } string Header = ThisLine.Split('\t')[0]; string Data = ThisLine.Remove(0, ((Header.Length) + 1)); var Converted = Utilities.IO.StringToVariable(Data); //NOTE: These WILL Bypass GUI mode if enabled, as the GUI setting is turned on until it is read. //if (Converted is Boolean) Logger.Console.WriteLine(String.Format("Bool: {0}", Data)); //if (Converted is IPAddress) Logger.Console.WriteLine(String.Format("IPAddress: {0}", Data)); //if (Converted is Decimal) Logger.Console.WriteLine(String.Format("Decimal: {0}", Data)); //if (Converted is Int32) Logger.Console.WriteLine(String.Format("Int32: {0}", Data)); //if (Converted is String) Logger.Console.WriteLine(String.Format("String: {0}", Data)); #endregion if (Key.ToUpperInvariant() != Header.ToUpperInvariant()) { Output.Add(line); continue; } switch (Header.ToUpperInvariant()) { #region Switches case Strings.Name: Output.Add(Strings.Name + "\t\t" + Name); found = true; break; case Strings.DisplayedName: Output.Add(Strings.DisplayedName + "\t\t" + DisplayedName.ToString()); found = true; break; case Strings.LastIP: Output.Add(Strings.LastIP + "\t\t\t" + LastIP.ToString()); found = true; break; case Strings.LoginCount: Output.Add(Strings.LoginCount + "\t\t" + LoginCount.ToString()); found = true; break; case Strings.MessagesTyped: Output.Add(Strings.MessagesTyped + "\t\t" + MessagesTyped.ToString()); found = true; break; case Strings.DateJoined: Output.Add(Strings.DateJoined + "\t\t" + DateJoined.ToString()); found = true; break; case Strings.DateLastVisited: Output.Add(Strings.DateLastVisited + "\t\t" + DateLastVisited.ToString()); found = true; break; case Strings.PlayTime: Output.Add(Strings.PlayTime + "\t\t" + PlayTime.ToString()); found = true; break; case Strings.Kills: Output.Add(Strings.Kills + "\t\t\t" + Kills.ToString()); found = true; break; case Strings.Deaths: Output.Add(Strings.Deaths + "\t\t\t" + Deaths.ToString()); found = true; break; case Strings.FlightsFlown: Output.Add(Strings.FlightsFlown + "\t\t" + FlightsFlown.ToString()); found = true; break; case Strings.FlightHours: Output.Add(Strings.FlightHours + "\t\t" + FlightHours.ToString()); found = true; break; case Strings.Banned: Output.Add(Strings.Banned + "\t\t\t" + Banned.ToString()); found = true; break; case Strings.BannedBy: Output.Add(Strings.BannedBy + "\t\t" + BannedBy.ToString()); found = true; break; case Strings.DateBanned: Output.Add(Strings.DateBanned + "\t\t" + DateBanned.ToString()); found = true; break; case Strings.BanExpires: Output.Add(Strings.BanExpires + "\t\t" + BanExpires.ToString()); found = true; break; case Strings.BanReason: Output.Add(Strings.BanReason + "\t\t" + BanReason.ToString()); found = true; break; case Strings.TimesBanned: Output.Add(Strings.TimesBanned + "\t\t" + TimesBanned.ToString()); found = true; break; case Strings.Frozen: Output.Add(Strings.Frozen + "\t\t\t" + Frozen.ToString()); found = true; break; case Strings.FrozenBy: Output.Add(Strings.FrozenBy + "\t\t" + FrozenBy.ToString()); found = true; break; case Strings.DateFrozen: Output.Add(Strings.DateFrozen + "\t\t" + DateFrozen.ToString()); found = true; break; case Strings.FreezeExpires: Output.Add(Strings.FreezeExpires + "\t\t" + FreezeExpires.ToString()); found = true; break; case Strings.FreezeReason: Output.Add(Strings.FreezeReason + "\t\t" + FreezeReason.ToString()); found = true; break; case Strings.TimesFrozen: Output.Add(Strings.TimesFrozen + "\t\t" + TimesFrozen.ToString()); found = true; break; case Strings.Muted: Output.Add(Strings.Muted + "\t\t\t" + Muted.ToString()); found = true; break; case Strings.MutedBy: Output.Add(Strings.MutedBy + "\t\t\t" + MutedBy.ToString()); found = true; break; case Strings.DateMuted: Output.Add(Strings.DateMuted + "\t\t" + DateMuted.ToString()); found = true; break; case Strings.MuteExpires: Output.Add(Strings.MuteExpires + "\t\t" + MuteExpires.ToString()); found = true; break; case Strings.MuteReason: Output.Add(Strings.MuteReason + "\t\t" + MuteReason.ToString()); found = true; break; case Strings.TimesMuted: Output.Add(Strings.TimesMuted + "\t\t" + TimesMuted.ToString()); found = true; break; case Strings.Kicked: Output.Add(Strings.Kicked + "\t\t\t" + Kicked.ToString()); found = true; break; case Strings.KickedBy: Output.Add(Strings.KickedBy + "\t\t" + KickedBy.ToString()); found = true; break; case Strings.DateKicked: Output.Add(Strings.DateKicked + "\t\t" + DateKicked.ToString()); found = true; break; case Strings.KickReason: Output.Add(Strings.KickReason + "\t\t" + KickReason.ToString()); found = true; break; case Strings.TimesKicked: Output.Add(Strings.TimesKicked + "\t\t" + TimesKicked.ToString()); found = true; break; case Strings.OthersBanned: Output.Add(Strings.OthersBanned + "\t\t" + OthersBanned.ToString()); found = true; break; case Strings.OthersFrozen: Output.Add(Strings.OthersFrozen + "\t\t" + OthersFrozen.ToString()); found = true; break; case Strings.OthersMuted: Output.Add(Strings.OthersMuted + "\t\t" + OthersMuted.ToString()); found = true; break; case Strings.OthersKicked: Output.Add(Strings.OthersKicked + "\t\t" + OthersKicked.ToString()); found = true; break; case Strings.GroupRepresented: Output.Add(Strings.GroupRepresented + "\t" + GroupRepresented.ToString()); found = true; break; #endregion default: Logger.Log.SystemMessage(String.Format("Unrecognised Value: {0}", Header)); //Unrecognised Value. break; } } if (!found) { switch (Key) { #region Switches case Strings.Name: Output.Add(Strings.Name + "\t\t" + Name); found = true; break; case Strings.DisplayedName: Output.Add(Strings.DisplayedName + "\t\t" + DisplayedName.ToString()); found = true; break; case Strings.LastIP: Output.Add(Strings.LastIP + "\t\t\t" + LastIP.ToString()); found = true; break; case Strings.LoginCount: Output.Add(Strings.LoginCount + "\t\t" + LoginCount.ToString()); found = true; break; case Strings.MessagesTyped: Output.Add(Strings.MessagesTyped + "\t\t" + MessagesTyped.ToString()); found = true; break; case Strings.DateJoined: Output.Add(Strings.DateJoined + "\t\t" + DateJoined.ToString()); found = true; break; case Strings.DateLastVisited: Output.Add(Strings.DateLastVisited + "\t\t" + DateLastVisited.ToString()); found = true; break; case Strings.PlayTime: Output.Add(Strings.PlayTime + "\t\t" + PlayTime.ToString()); found = true; break; case Strings.Kills: Output.Add(Strings.Kills + "\t\t\t" + Kills.ToString()); found = true; break; case Strings.Deaths: Output.Add(Strings.Deaths + "\t\t\t" + Deaths.ToString()); found = true; break; case Strings.FlightsFlown: Output.Add(Strings.FlightsFlown + "\t\t" + FlightsFlown.ToString()); found = true; break; case Strings.FlightHours: Output.Add(Strings.FlightHours + "\t\t" + FlightHours.ToString()); found = true; break; case Strings.Banned: Output.Add(Strings.Banned + "\t\t\t" + Banned.ToString()); found = true; break; case Strings.BannedBy: Output.Add(Strings.BannedBy + "\t\t" + BannedBy.ToString()); found = true; break; case Strings.DateBanned: Output.Add(Strings.DateBanned + "\t\t" + DateBanned.ToString()); found = true; break; case Strings.BanExpires: Output.Add(Strings.BanExpires + "\t\t" + BanExpires.ToString()); found = true; break; case Strings.BanReason: Output.Add(Strings.BanReason + "\t\t" + BanReason.ToString()); found = true; break; case Strings.TimesBanned: Output.Add(Strings.TimesBanned + "\t\t" + TimesBanned.ToString()); found = true; break; case Strings.Frozen: Output.Add(Strings.Frozen + "\t\t\t" + Frozen.ToString()); found = true; break; case Strings.FrozenBy: Output.Add(Strings.FrozenBy + "\t\t" + FrozenBy.ToString()); found = true; break; case Strings.DateFrozen: Output.Add(Strings.DateFrozen + "\t\t" + DateFrozen.ToString()); found = true; break; case Strings.FreezeExpires: Output.Add(Strings.FreezeExpires + "\t\t" + FreezeExpires.ToString()); found = true; break; case Strings.FreezeReason: Output.Add(Strings.FreezeReason + "\t\t" + FreezeReason.ToString()); found = true; break; case Strings.TimesFrozen: Output.Add(Strings.TimesFrozen + "\t\t" + TimesFrozen.ToString()); found = true; break; case Strings.Muted: Output.Add(Strings.Muted + "\t\t\t" + Muted.ToString()); found = true; break; case Strings.MutedBy: Output.Add(Strings.MutedBy + "\t\t\t" + MutedBy.ToString()); found = true; break; case Strings.DateMuted: Output.Add(Strings.DateMuted + "\t\t" + DateMuted.ToString()); found = true; break; case Strings.MuteExpires: Output.Add(Strings.MuteExpires + "\t\t" + MuteExpires.ToString()); found = true; break; case Strings.MuteReason: Output.Add(Strings.MuteReason + "\t\t" + MuteReason.ToString()); found = true; break; case Strings.TimesMuted: Output.Add(Strings.TimesMuted + "\t\t" + TimesMuted.ToString()); found = true; break; case Strings.Kicked: Output.Add(Strings.Kicked + "\t\t\t" + Kicked.ToString()); found = true; break; case Strings.KickedBy: Output.Add(Strings.KickedBy + "\t\t" + KickedBy.ToString()); found = true; break; case Strings.DateKicked: Output.Add(Strings.DateKicked + "\t\t" + DateKicked.ToString()); found = true; break; case Strings.KickReason: Output.Add(Strings.KickReason + "\t\t" + KickReason.ToString()); found = true; break; case Strings.TimesKicked: Output.Add(Strings.TimesKicked + "\t\t" + TimesKicked.ToString()); found = true; break; case Strings.OthersBanned: Output.Add(Strings.OthersBanned + "\t\t" + OthersBanned.ToString()); found = true; break; case Strings.OthersFrozen: Output.Add(Strings.OthersFrozen + "\t\t" + OthersFrozen.ToString()); found = true; break; case Strings.OthersMuted: Output.Add(Strings.OthersMuted + "\t\t" + OthersMuted.ToString()); found = true; break; case Strings.OthersKicked: Output.Add(Strings.OthersKicked + "\t\t" + OthersKicked.ToString()); found = true; break; case Strings.GroupRepresented: Output.Add(Strings.GroupRepresented + "\t" + GroupRepresented.ToString()); found = true; break; #endregion default: Logger.Log.SystemMessage(String.Format("Unrecognised Value: {0}", Key)); //Unrecognised Value. break; } } try { File.WriteAllLines(OutputFile, Output.ToList()); } catch { } }
public override bool Execute(TransactionResultCapsule result) { long fee = CalcFee(); try { AssetIssueContract asset_issue_contract = contract.Unpack <AssetIssueContract>(); AssetIssueCapsule asset_issue = new AssetIssueCapsule(asset_issue_contract); AssetIssueCapsule asset_issue_v2 = new AssetIssueCapsule(asset_issue_contract); byte[] owner_address = asset_issue_contract.OwnerAddress.ToByteArray(); long token_id = this.db_manager.DynamicProperties.GetTokenIdNum(); token_id++; asset_issue.Id = token_id.ToString(); asset_issue_v2.Id = token_id.ToString(); this.db_manager.DynamicProperties.PutTokenIdNum(token_id); if (this.db_manager.DynamicProperties.GetAllowSameTokenName() == 0) { asset_issue_v2.Percision = 0; this.db_manager.AssetIssue.Put(asset_issue.CreateDatabaseKey(), asset_issue); this.db_manager.AssetIssueV2.Put(asset_issue_v2.CreateDatabaseKeyV2(), asset_issue_v2); } else { this.db_manager.AssetIssueV2.Put(asset_issue_v2.CreateDatabaseKeyV2(), asset_issue_v2); } this.db_manager.AdjustBalance(owner_address, -fee); this.db_manager.AdjustBalance(this.db_manager.Account.GetBlackHole().Address.ToByteArray(), fee); AccountCapsule account = this.db_manager.Account.Get(owner_address); List <FrozenSupply> frozen_supplys = new List <FrozenSupply>(asset_issue_contract.FrozenSupply); long remain_supply = asset_issue_contract.TotalSupply; List <Frozen> frozens = new List <Frozen>(); long startTime = asset_issue_contract.StartTime; foreach (AssetIssueContract.Types.FrozenSupply supply in asset_issue_contract.FrozenSupply) { long expire_time = startTime + supply.FrozenDays * 86_400_000; Frozen frozen = new Frozen(); frozen.FrozenBalance = supply.FrozenAmount; frozen.ExpireTime = expire_time; frozens.Add(frozen); remain_supply -= supply.FrozenAmount; } if (this.db_manager.DynamicProperties.GetAllowSameTokenName() == 0) { account.AddAsset(asset_issue.CreateDatabaseKey(), remain_supply); } account.AssetIssuedName = ByteString.CopyFrom(asset_issue.CreateDatabaseKey()); account.AssetIssuedID = ByteString.CopyFrom(asset_issue.CreateDatabaseKeyV2()); account.AddAssetV2(asset_issue_v2.CreateDatabaseKeyV2(), remain_supply); account.FrozenSupplyList.AddRange(frozens); this.db_manager.Account.Put(owner_address, account); result.AssetIssueID = token_id.ToString(); result.SetStatus(fee, code.Sucess); } catch (InvalidProtocolBufferException e) { Logger.Debug(e.Message); result.SetStatus(fee, code.Failed); throw new ContractExeException(e.Message); } catch (BalanceInsufficientException e) { Logger.Debug(e.Message); result.SetStatus(fee, code.Failed); throw new ContractExeException(e.Message); } catch (ArithmeticException e) { Logger.Debug(e.Message); result.SetStatus(fee, code.Failed); throw new ContractExeException(e.Message); } return(true); }
public void AddCharactersToList(string name, string item) { Frozen newFrozen = new Frozen(name, item); Characters.Add(newFrozen); }
public void AddFrozentoList(string title, string character) { Frozen newFrozen = new Frozen(title, character); frozens.Add(newFrozen); }