private void frm_NewChip_NewChipUpdated(object sender, NewChipUpdateEventArgs e) { //string RecName = ExtractRecordName(LastRightClickedNode.Text); if (SubChips.ProjectRoot.Length == 0) { SubChips.ProjectRoot = this.ProjectRoot; } string RecName = LastRightClickedNode.Text; if (SubChips.AddSubChipRows(e.XMLFileName, e.SampleFileName, e.ChipName, RecName) == true) { ChipInfo ci = new ChipInfo(); ci.chipname = e.ChipName; ci.owner = RecName; ci.chipid = e.ChipID; ci.xmlfilename = e.XMLFileName; ci.samplelistfilename = e.SampleFileName; ci.invlocalhandling = e.InvHandling; Chips.AddNewChip(ci); } }
public bool InitializeInterface() { if (m_settings.AutoDetect) { string str2 = OBD2.Int2HexString(50); if (getResponse(new OBD2Request("ATST" + str2)) != null) { if (ChipInfo.IndexOf("ELM327") >= 0) { getResponse(new OBD2Request("ATSP0")); if (getResponse(new OBD2Request("0101")).Response.IndexOf("4101") >= 0) { return(true); } int num = 1; do { getResponse(new OBD2Request("ATSP" + num.ToString())); if (getResponse(new OBD2Request("0101")).Response.IndexOf("4101") >= 0) { return(true); } num++; }while (num < 10); } else if (getResponse(new OBD2Request("0101")).Response.IndexOf("4101") >= 0) { return(true); } } return(false); } string strRequest = "ATST" + m_strElmTimeout; if (getResponse(new OBD2Request(strRequest)) == null) { return(false); } if (m_settings.HardwareIndex == 1) { if (!m_settings.DoInitialization && (getResponse(new OBD2Request("ATBI")) == null)) { return(false); } int protocolIndex = m_settings.ProtocolIndex; if (getResponse(new OBD2Request("ATSP" + protocolIndex.ToString())) == null) { return(false); } if (m_settings.ProtocolIndex == 0) { getResponse(new OBD2Request("0100")); } } return(true); }
public void UpdateChip(string chipname, ChipInfo ci) { int rowindex = FindChipIndexByName(chipname); Data.Rows[rowindex]["ChipName"] = ci.chipname; Data.Rows[rowindex]["ID"] = ci.chipid; Data.Rows[rowindex]["XMLFile"] = ci.xmlfilename; Data.Rows[rowindex]["SampleListFile"] = ci.samplelistfilename; Data.Rows[rowindex]["NumSubChips"] = ci.numsubchips; Data.Rows[rowindex]["InvLocalHandling"] = ci.invlocalhandling; }
private void frm_EditChip_EditChipUpdated(object sender, NewChipUpdateEventArgs e) { ChipInfo ci = new ChipInfo(); ci.chipname = e.ChipName; ci.chipid = e.ChipID; ci.xmlfilename = e.XMLFileName; ci.samplelistfilename = e.SampleFileName; ci.invlocalhandling = e.InvHandling; Chips.UpdateChip(LastRightClickedNode.Text, ci); }
private void SelectChip(ChipInfo chip) { if (selectedChip != chip.gameObject && chip.chipTeam == GameController.instance.playerTeam) { dragged = true; selectedChip = chip.gameObject; Renderer renderer = selectedChip.GetComponent <Renderer>(); Material material = renderer.material; material.SetColor("_EmissiveColor", material.GetColor("_EmissiveColor") * 8f); lr.material.SetColor("_EmissiveColor", material.GetColor("_EmissiveColor") / 6); } }
public static void Postfix(GameScript __instance, int slot, int[] ___combatChips) { int chipID = ___combatChips[slot]; if (ChipRegistry.Singleton.HasEntry(chipID)) { ChipInfo chip = ChipRegistry.Singleton.GetEntry(chipID); if ((chip.Type & ChipType.ACTIVE) > 0 && chip.Cost > 0) { __instance.txtChipCost[0].text = chip.Cost + (chip.CostType == ChipInfo.ChipCostType.MANA ? " Mana" : (chip.CostType == ChipInfo.ChipCostType.ENERGY ? " Energy" : " Health")); } } }
private ChipInfo CurrentChooseChip = null; //当前选择的芯片. private void ChooseChipMenuItem_Click(object sender, EventArgs e1) { if (_ChooseChipFrom == null) { _ChooseChipFrom = new ChooseChipFrom(); _ChooseChipFrom.StateChanged += delegate(object o, EventArgs e) { ChooseChipFrom.ChooseChipFromEventArgs args = e as ChooseChipFrom.ChooseChipFromEventArgs; CurrentChooseChip = args.ChipInfo; AccordionPanel.CurrentChipInfo = CurrentChooseChip; }; } _ChooseChipFrom.ShowDialog(); }
public void AddNewChip(ChipInfo ci) { DataRow dr = Data.NewRow(); dr["ChipName"] = ci.chipname; dr["Owner"] = ci.owner; dr["ID"] = ci.chipid; dr["XMLFile"] = ci.xmlfilename; dr["SampleListFile"] = ci.samplelistfilename; dr["NumSubChips"] = ci.numsubchips; dr["InvLocalHandling"] = ci.invlocalhandling; Data.Rows.Add(dr); }
public ChipInfo GetChipInfo(string chipname) { ChipInfo ci = new ChipInfo(); int rowindex = FindChipIndexByName(chipname); ci.chipname = Data.Rows[rowindex]["ChipName"].ToString(); ci.chipid = Data.Rows[rowindex]["ID"].ToString(); ci.xmlfilename = Data.Rows[rowindex]["XMLFile"].ToString(); ci.samplelistfilename = Data.Rows[rowindex]["SampleListFile"].ToString(); ci.numsubchips = Convert.ToInt32(Data.Rows[rowindex]["NumSubChips"]); ci.invlocalhandling = Data.Rows[rowindex]["InvLocalHandling"].ToString(); return(ci); }
private void OnTriggerExit(Collider other) { if (other.tag == "Chip") { other.gameObject.SetActive(false); ChipInfo ci = other.GetComponent <ChipInfo>(); if (ci.chipTeam == gc.playerTeam) { DeletePlayerChip(other.gameObject); } else { DeleteEnemyChip(other.gameObject); } gc.CheckForWin(); } }
public FormChipSettings(string projfolder, ChipInfo ci) { InitializeComponent(); this.ProjectRoot = projfolder; tb_chipname.Text = ci.chipname; tb_chipid.Text = ci.chipid; tb_xmlfilename.Text = ci.xmlfilename; tb_samplefilename.Text = ci.samplelistfilename; if (ci.invlocalhandling == "Yes") { rbtn_invyes.Checked = true; } else { rbtn_invno.Checked = true; } }
public static int ultimoDigito(string iccid) { List <ChipInfo> lista = new List <ChipInfo>(); ChipInfo item; int retorno; char[] digito = iccid.ToCharArray(); try { int pos = 0; foreach (char texto in digito) { try { retorno = Convert.ToInt32(texto.ToString()); item = new ChipInfo(); item.Position = pos + 1; item.ThisChar = retorno.ToString(); item.Doubled = null; item.Summed = null; lista.Add(item); pos++; } catch { pos++; } } bool positivo = false; if ((lista.Count % 2) == 0) { positivo = true; } int idouble; for (int i = 0; i < lista.Count; i++) { if (positivo) { if ((lista[i].Position % 2) == 0) { idouble = Convert.ToInt32(lista[i].ThisChar) * 2; lista[i].Doubled = idouble; } else { continue; } } else { if ((lista[i].Position % 2) == 0) { continue; } else { idouble = Convert.ToInt32(lista[i].ThisChar) * 2; lista[i].Doubled = idouble; } } } for (int i = 0; i < lista.Count; i++) { Int64?doubled = lista[i].Doubled; int resultado; if (doubled == null) { resultado = Convert.ToInt32(lista[i].ThisChar); lista[i].Summed = resultado; } else { if (doubled <= 9) { lista[i].Summed = doubled; } else { resultado = (Convert.ToInt32(doubled) / 10) + (Convert.ToInt32(doubled) - 10); lista[i].Summed = resultado; } } } retorno = 0; foreach (ChipInfo chip in lista) { retorno += Convert.ToInt32(chip.Summed); } int resto = retorno % 10; resto = 10 - resto; if (resto == 10) { resto = 0; } return(resto); } catch { return(-1); } }
public BaseChip() { combatChip = new ChipInfo(Type, Name, Description, Cost, ObjectTexture, Stats, CostType); }
private void CompletedReadScanBoardProp(CompletedReadScanBdPropInfo info) { string operateStr = ""; CommMsgType commType = CommMsgType.Information; if (info.ReadRes == ReadConfigRes.Succeed) { _scanBdProp = info.ScanBdProperty; ChipType chipType = _scanBdProp.StandardLedModuleProp.DriverChipType; _chipConfig = ChipRegistorConfigFactory.GetChipRegistorConfig(chipType); if (ChipInherDict.ContainsKey(chipType)) { _curChipInfo = ChipInherDict[chipType]; IsSupportCurrentGain = _curChipInfo.IsSupportCurrentGain; } else { IsSupportCurrentGain = false; } UpdateScanBdPropToUI(info.ScanBdProperty); CommonStaticMethod.GetLanguageString("读取参数成功!", "Lang_Bright_ReadParams_Succeed", out operateStr); commType = CommMsgType.Information; } else { _scanBdProp = new ScanBoardProperty(); IsSupportCurrentGain = false; string msg = ""; CommonStaticMethod.GetLanguageString("读取芯片类型失败!", "Lang_Bright_ReadChipFailed", out msg); ChipName = msg; CommonStaticMethod.GetLanguageString("读取参数失败!", "Lang_Bright_ReadParams_Failed", out operateStr); commType = CommMsgType.Error; } //NotifyMessage(this, new NotifyMessageEventArgs(new CommMsg() { Msg = operateStr, MsgType = commType })); }
public ModdedChip(ChipInfo chip) { chipInfo = chip; }
private void GetRegistorGainFromStep(ChipInfo chipInfo, int step, out int registorVal, out float curGainPercent) { registorVal = 0; curGainPercent = 0; if (chipInfo == null) { return; } Dictionary<int, RegistorGainMapping> mapping = chipInfo.CurrentGainStepInfo.GainStepMapping; if (!mapping.ContainsKey(step)) { return; } registorVal = mapping[step].RegistorValue; curGainPercent = mapping[step].CurrentGain; }
public static bool Prefix(GameScript __instance, int slot, ref int[] ___combatChips, ref bool ___skilling, ref bool[] ___skillUsin) { if (GadgetCoreAPI.IsInputFrozen()) { return(false); } int chipID = ___combatChips[slot]; if (ChipRegistry.Singleton.HasEntry(chipID)) { ChipInfo chip = ChipRegistry.Singleton.GetEntry(chipID); if (!___skilling && !___skillUsin[slot]) { ___skillUsin[slot] = true; __instance.StartCoroutine(SkillUsin(slot, ___skillUsin)); __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/error"), Menuu.soundLevel / 10f); __instance.combatChipObj[slot].GetComponent <Animation>().Play(); if (chip.IsChipActive(slot)) { return(false); } int cost = chip.Cost; // TODO: Make chip cost cancelable. if (Menuu.curAugment == 18) { cost /= 2; } if (cost < 0) { cost = 0; } if ((chip.Type & ChipType.ACTIVE) > 0) { if ((chip.CostType == ChipInfo.ChipCostType.MANA && GameScript.mana >= cost) || (chip.CostType == ChipInfo.ChipCostType.ENERGY && GameScript.energy >= cost) || (chip.CostType == ChipInfo.ChipCostType.HEALTH_SAFE && GameScript.hp > cost) || chip.CostType == ChipInfo.ChipCostType.HEALTH_LETHAL || chip.CostType == ChipInfo.ChipCostType.HEALTH_LETHAL_POSTMORTEM) { GameObject gameObject = (GameObject)Object.Instantiate(Resources.Load("txtSkill"), new Vector3(0f, 0f, 0f), Quaternion.identity); gameObject.transform.parent = Camera.main.transform; gameObject.transform.localPosition = new Vector3(-14f, 7f, 0.35f); gameObject.SendMessage("InitSkill", chip.Name); if (chip.CostType == ChipInfo.ChipCostType.MANA) { GameScript.mana -= cost; __instance.BARMANA.GetComponent <Animation>().Play(); chip.InvokeOnUse(slot); __instance.StartCoroutine(WaitChip(__instance)); __instance.UpdateMana(); } else if (chip.CostType == ChipInfo.ChipCostType.ENERGY) { GameScript.energy -= cost; chip.InvokeOnUse(slot); __instance.StartCoroutine(WaitChip(__instance)); __instance.UpdateEnergy(); } else { GameScript.hp -= cost; if (GameScript.hp <= 0) { GameScript.dead = true; } if (GameScript.hp > 0 || chip.CostType == ChipInfo.ChipCostType.HEALTH_LETHAL_POSTMORTEM) { chip.InvokeOnUse(slot); __instance.StartCoroutine(WaitChip(__instance)); } if (GameScript.hp <= 0) { GameScript.dead = true; GameScript.hp = 0; Die.Invoke(__instance, new object[] { }); } else { GameScript.dead = false; } __instance.UpdateHP(); } } } } return(false); } return(true); }