public void saveAttribute() { //Find seleted obj myObject = GameObject.FindGameObjectWithTag("Selected"); MyScript myScriptVariable = myObject.GetComponent <MyScript>(); //Find obj panel in obj ScriptActive myPanelVariable = myObject.GetComponent <ScriptActive>(); myPanel = myPanelVariable.scriptBox; //This part should generate or sent something to [MyScript.cs] of [seleted object(myObject)] foreach (Transform obj in myPanel.transform) { if (obj.name == "Slot" || obj.name == "Slot(Clone)") { SlotAttachment slotVariable = obj.GetComponent <SlotAttachment>(); if (slotVariable.script) { GameObject slotScripts = slotVariable.script; Debug.Log("FOUND: " + slotScripts.name); /////////sent SCRIPTS to OBJ down here//////// } else { break; } } } myScriptVariable.isResetScript = true; }
// Start is called before the first frame update void Start() { Screen.orientation = ScreenOrientation.Portrait; MyScript.UpdateScores(); Hs1.text = PlayerPrefs.GetInt("Game1Score").ToString(); Hs2.text = PlayerPrefs.GetInt("Game2Score").ToString(); Hs3.text = PlayerPrefs.GetInt("Game3Score").ToString(); }
public override void OnEnable() { base.OnEnable(); MyScript.mod = this; GameObject go = new GameObject(); script = go.AddComponent <MyScript>(); script.Initialize(); }
static void DrawGizmoForMyScript(MyScript scr, GizmoType gizmoType) { Vector3 position = scr.transform.position; if (Vector3.Distance(position, Camera.current.transform.position) > 10f) { Gizmos.DrawIcon(position, "MyScript Gizmo.png", true); } }
public static void Main(string[] args) { MyScript script = new MyScript(); if (args == null || args.Length < 1 || args[0] == null || args[1] == null) { return; } script.setCity(args[0]); script.setUnits(args[1]); script.getWeather(); }
public static void Main(string[] args) { MyScript script = new MyScript(); if (args == null || args.Length < 1 || args[0] == null || args[1] == null) { return; } script.setCity(args[1]); float Lat = float.Parse(args[2]); float Long = float.Parse(args[3]); script.setKey(args[0]); script.setLat(Lat); script.setLong(Long); script.getWeather(); }
void OnEnable() { // Setup serialized property listPoints = serializedObject.FindProperty("listPoints"); planDepart = serializedObject.FindProperty("planDepart"); planArrive = serializedObject.FindProperty("planArrive"); listProperty = serializedObject.FindProperty ("arrayOfZone"); script = target as MyScript; zones = script.arrayOfZone; }
private void OnEnable() { _target = (MyScript)target; }
static public void Load() { try { Console.WriteLine($"{DateTime.Now}: Начат процесс загрузки…"); MyBotSettings.Load(); ImmutableList <MyPlayer> .Builder playersBuilder = ImmutableList.CreateBuilder <MyPlayer>(); ImmutableList <MyFaction> .Builder factionsBuilder = ImmutableList.CreateBuilder <MyFaction>(); ImmutableList <MySector> .Builder sectorsBuilder = ImmutableList.CreateBuilder <MySector>(); ImmutableList <MyPolitic> .Builder politicsBuilder = ImmutableList.CreateBuilder <MyPolitic>(); ImmutableList <AMyFight> .Builder fightsBuilder = ImmutableList.CreateBuilder <AMyFight>(); ImmutableList <MyOffer> .Builder offersBuilder = ImmutableList.CreateBuilder <MyOffer>(); ImmutableList <MyScript> .Builder scriptsBuilder = ImmutableList.CreateBuilder <MyScript>(); ImmutableList <MyTimer> .Builder timersBuilder = ImmutableList.CreateBuilder <MyTimer>(); Parallel.Invoke(() => Parallel.ForEach(Directory.GetFiles(SavePathPlayers), item => { using (FileStream stream = File.OpenRead(item)) { MyPlayer player = (MyPlayer)MyPlayerSerializer.ReadObject(stream); lock (playersBuilder) { playersBuilder.Add(player); } } }), () => Parallel.ForEach(Directory.GetFiles(SavePathFactions), item => { using (FileStream stream = File.OpenRead(item)) { MyFaction faction = (MyFaction)MyFactionSerializer.ReadObject(stream); lock (factionsBuilder) { factionsBuilder.Add(faction); } } }), () => Parallel.ForEach(Directory.GetFiles(SavePathSectors), item => { using (FileStream stream = File.OpenRead(item)) { MySector sector = (MySector)MySectorSerializer.ReadObject(stream); lock (sectorsBuilder) { sectorsBuilder.Add(sector); } } }), () => Parallel.ForEach(Directory.GetFiles(SavePathPolitics), item => { using (FileStream stream = File.OpenRead(item)) { MyPolitic pol = (MyPolitic)MyPoliticSerializer.ReadObject(stream); lock (politicsBuilder) { politicsBuilder.Add(pol); } } }), () => Parallel.ForEach(Directory.GetFiles(SavePathFights), item => { using (FileStream stream = File.OpenRead(item)) { AMyFight fight; if (item.Contains("@S")) { fight = (MySectorFight)MySectorFightSerializer.ReadObject(stream); } else if (item.Contains("@T")) { fight = (MyTradeShipFight)MyTradeShipFightSerializer.ReadObject(stream); } else if (item.Contains("@C")) { fight = (MyCustomFight)MyCustomFightSerializer.ReadObject(stream); } else { throw new FileLoadException("Неизвестный тип боя", item); } lock (fightsBuilder) { fightsBuilder.Add(fight); } } }), () => Parallel.ForEach(Directory.GetFiles(SavePathOffers), item => { using (FileStream stream = File.OpenRead(item)) { MyOffer offer = (MyOffer)MyOfferSerializer.ReadObject(stream); lock (offersBuilder) { offersBuilder.Add(offer); } } }), () => Parallel.ForEach(Directory.GetFiles(SavePathScripts), item => { using (FileStream stream = File.OpenRead(item)) { MyScript scr = (MyScript)MyScriptSerializer.ReadObject(stream); lock (scriptsBuilder) { scriptsBuilder.Add(scr); } } }), () => Parallel.ForEach(Directory.GetFiles(SavePathTimers), item => { using (FileStream stream = File.OpenRead(item)) { MyTimer timer = (MyTimer)MyTimerSerializer.ReadObject(stream); lock (timersBuilder) { timersBuilder.Add(timer); } } })); playersBuilder.Sort(); factionsBuilder.Sort(); sectorsBuilder.Sort(); Players = playersBuilder.ToImmutable(); Factions = factionsBuilder.ToImmutable(); Sectors = sectorsBuilder.ToImmutable(); Politics = politicsBuilder.ToImmutable(); Fights = fightsBuilder.ToImmutable(); Offers = offersBuilder.ToImmutable(); Scripts = scriptsBuilder.ToImmutable(); Timers = timersBuilder.ToImmutable(); Console.WriteLine($"{DateTime.Now}: Загрузка завершена"); } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"{DateTime.Now}: Исключение во время попытки загрузки: {e.Message}\r\n{e.StackTrace}"); Console.ForegroundColor = ConsoleColor.Green; } }
protected void btnSearch_Click(object sender, ImageClickEventArgs e) { string strCustNo = txtSearchCode.Text; bool textIsNumeric = true; try { int.Parse(strCustNo); } catch { textIsNumeric = false; } if (!textIsNumeric) { ScriptManager.RegisterClientScriptBlock(txtSearchCode, txtSearchCode.GetType(), "Customer", "LoadCustomerLookup('" + Server.UrlEncode(PFC.Intranet.Securitylayer.Cryptor.Encrypt(strCustNo)) + "','" + txtSearchCode.ClientID + "');", true); } else { DataTable dtCustomerMaster = customerContact.GetCustomerMasterInformation(txtSearchCode.Text.Trim()); string _creditInd = ""; if (dtCustomerMaster != null && dtCustomerMaster.Rows.Count > 0) { _creditInd = dtCustomerMaster.Rows[0]["CreditInd"].ToString().ToUpper().Trim(); } if (dtCustomerMaster != null && dtCustomerMaster.Rows.Count > 0 && _creditInd != "X") { // // Fill information in header // lblCustName.Text = dtCustomerMaster.Rows[0]["CustName"].ToString(); lblAddress.Text = dtCustomerMaster.Rows[0]["AddrLine1"].ToString(); lblCity.Text = dtCustomerMaster.Rows[0]["City"].ToString(); lblState.Text = dtCustomerMaster.Rows[0]["State"].ToString(); lblPostCode.Text = dtCustomerMaster.Rows[0]["PostCd"].ToString(); lblCountry.Text = dtCustomerMaster.Rows[0]["Country"].ToString(); hidCustMasterID.Value = dtCustomerMaster.Rows[0]["pCustomerAddressID"].ToString(); hidCustNo.Value = txtSearchCode.Text.Trim(); // ----------------------------------------------------------------------------// ToggleContact(true); BindDataGrid(); tblBuyingGrp.Visible = true; SetDropDownValue(ddlPriceCd, dtCustomerMaster.Rows[0]["PriceCd"].ToString()); SetDropDownValue(ddlBuyingGroup, dtCustomerMaster.Rows[0]["BuyGroup"].ToString()); SetDropDownValue(ddlCustomerType, dtCustomerMaster.Rows[0]["CustType"].ToString()); } else { ClearALL(); tblBuyingGrp.Visible = false; dlContacts.DataSource = null; dlContacts.DataBind(); if (_creditInd == "X") { DisplaStatusMessage("Customer is on hold, contacts cannot be edited", "Fail"); } else { DisplaStatusMessage("Invalid Customer Search value", "Fail"); } upnlContactGrid.Update(); pnlProgress.Update(); trContent1.Style.Add(HtmlTextWriterStyle.Display, "none"); trContent2.Style.Add(HtmlTextWriterStyle.Display, "none"); MyScript.SetFocus(txtSearchCode); } ToggleEntry(false); pnlCustHeader.Update(); } }
// Update is called once per frame void Update() { MyScript primaryScript = GetComponent <MyScript> (); transform.Rotate(Vector3.up * primaryScript.speed); }