public override void OnInspectorGUI() { ctrl controller = (ctrl)target; DrawDefaultInspector(); if (GUILayout.Button("load png")) { controller.ReadPng(); } if (GUILayout.Button("generate Perlin noise")) { controller.GeneratePerlinNoise(); } if (GUILayout.Button("terrain")) { controller.Terrain(); } if (GUILayout.Button("save as PNG")) { controller.SaveAsPNG(controller.heightMap); } if (GUILayout.Button("run GAN on server")) { controller.RunGANOnServer(); } if (GUILayout.Button("ReadPngFromFile")) { controller.ReadPngFromDisk(); } }
// Use this for initialization void Start() { menu = SceneManager.GetActiveScene().name == "menu"; if (!menu) { // Grab reference to the controller script C = Camera.main.GetComponent <ctrl>(); // Sets the max lap according to the controller lap.y = C.mLaps; } else { nn.IniWeights(new float[] { 3.472079f, 1.762525f, -2.266208f, 0.8920379f, -3.915989f, -1.762377f, -2.844904f, 3.381477f, 1.12464f, -3.086241f, 3.320154f, 0.1941123f, 0.1791953f, -3.122393f, 0.8971314f, 0.1158746f, 3.512217f, 1.440832f, 3.3429f, -3.377463f, -2.171291f, 1.523072f, -2.242229f, -2.650826f, 3.01321f, -3.341551f, 3.746894f, -1.755286f, -0.3875917f }); } // Grab ref to ridgid body component rb = GetComponent <Rigidbody>(); // Set rotation constraints so Forrest doesn't fall over rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ; // Grab ref to collider col = GetComponent <Collider>(); // tag = "Active"; // Set the laps to 1 instead of 0 at every start no matter what lap.x = 1; }
// Use this for initialization void Start() { barTime *= (barTimeInMinutes) ? 60:1; barTimeInMinutes = false; valid = true; scored = false; legal = false; endgame = false; playing = false; currentPlayer = 0; instance = this; players = new List <Player>(); for (int i = 0; i < UI.myText.Count; i++) { UI.myText[i].enabled = false; } for (int i = 0; i < playerCount; i++) { players.Add(new Player(i + 1)); UI.myText[i].enabled = true; } UI.myText[0].color = Color.green; UI.updateScore(); }
public void HandleSnake(ctrl key) { if (key == ctrl.RightArrow && Direction != direction.LEFT) Direction = direction.RIGHT; else if (key == ctrl.LeftArrow && Direction != direction.RIGHT) Direction = direction.LEFT; else if (key == ctrl.UpArrow && Direction != direction.DOWN) Direction = direction.UP; else if (key == ctrl.DownArrow && Direction != direction.UP) Direction = direction.DOWN; }
// Use this for initialization void Start() { C = Camera.main.GetComponent <ctrl>(); if (type == Type.builder) { GameObject F = new GameObject("MAP"); // hex = Resources.Load <GameObject>("hex"); bool final = (saveFile == "FINAL"); if (!final) { GenHex(F); } else { C.Ff.SetActive(true); } // Set the right demensions F.transform.localScale = (Vector3.one * 5) + (Vector3.up * 2); // if (SceneManager.GetActiveScene().name == "course") { GameObject stSp = GameObject.Find("StartSphere"); if (!final) { stSp.transform.position = new Vector3(startPt.x, 0, startPt.z); stSp.transform.eulerAngles = Vector3.up * (startPt.w + ((reverse) ? 180 : 0)); } else { stSp.transform.eulerAngles = Vector3.up * (((reverse) ? 180 : 0)); } C.NewDay(); } else { // Msg.gameObject.SetActive(false); } } }
public override void OnInspectorGUI() { ctrl controller = (ctrl)target; DrawDefaultInspector(); if (GUILayout.Button("load png")) { controller.ReadPng(); } if (GUILayout.Button("generate Perlin noise")) { controller.GeneratePerlinNoise(); } if (GUILayout.Button("flat")) { controller.Flat(); } if (GUILayout.Button("terrain")) { controller.Terrain(); } if (GUILayout.Button("save as PNG")) { controller.SaveAsPNG(controller.heightMap); } if (GUILayout.Button("HeightmapGAN")) { controller.HeightmapGAN(); } if (GUILayout.Button("SatelliteGAN")) { controller.SatelliteGAN(); } if (GUILayout.Button("ReadPngFromFile")) { controller.ReadPngFromDisk(); } }
void ITemplate.InstantiateIn(System.Web.UI.Control container) { switch (_templateType) { case ListItemType.Header: { _iField++; if (_typeCtrl != TypeTemplateCol.action && _typeCtrl != TypeTemplateCol.action_url && _typeCtrl != TypeTemplateCol.request && _typeCtrl != TypeTemplateCol.tabledel && _typeCtrl != TypeTemplateCol.tablelink) { html_ctrl fld = new html_ctrl("div", new attrs(new string[, ] { { "class", "header-col" } })); // titolo colonna attrs atrs = new attrs(new string[, ] { { "colgrid", "true" }, { "oncontextmenu", "col_contextmenu('" + _grid_id + "', '" + _fld_name + "')" } }); XmlNode h_node = refHeader(); ctrl c_title = h_node != null ? (ctrl) new link(_col_title, xmlDoc.node_val(h_node, "title") != "" ? xmlDoc.node_val(h_node, "title") : _col_des, "title-col" , _page.page.parse(h_node.Attributes["ref"].Value), atrs) : (ctrl) new label(_col_title, "title-col", _col_des, atrs); fld.add(c_title.control); // freccine ordinamento string direction; bool sorted = grid_ctrl.find_sort_field(grid_ctrl.xmlOfGrid(_page, _grid_id), _fld_name, out direction); ctrl f_ctrl = new div(null, "<div class='arrows' title=\".\" " + " field_name='" + _fld_name + "' onclick=\"updateGridSort('" + _grid_id + "', '" + _fld_name + "')\" oncontextmenu=\"col_contextmenu('" + _grid_id + "', '" + _fld_name + "')\">" + (!sorted ? "<a class='mif-arrow-up arrow-col'></a>" : (direction.ToLower() == "asc" ? "<a class='mif-arrow-up arrow-col-active'></a>" : "<a class='mif-arrow-down arrow-col-active'></a>")) + "</div>"); fld.add(f_ctrl.control); container.Controls.Add(fld.control); } } break; case ListItemType.Item: { _iField++; // creazione del controllo WebControl ctrl = null; bool notTransparent = false; if (_typeCtrl == TypeTemplateCol.text) { ctrl = refItem() != null ? new link(new EventHandler(textlink_DataBinding)).w_ctrl : new text(new EventHandler(text_DataBinding), true).w_ctrl; } else if (_typeCtrl == TypeTemplateCol.integer) { ctrl = refItem() != null ? new link(new EventHandler(intlink_DataBinding)).w_ctrl : new label(new EventHandler(int_DataBinding)).lbl; } else if (_typeCtrl == TypeTemplateCol.euro) { ctrl = refItem() != null ? new link(new EventHandler(eurolink_DataBinding)).w_ctrl : new label(new EventHandler(euro_DataBinding)).lbl; } else if (_typeCtrl == TypeTemplateCol.real) { ctrl = refItem() != null ? new link(new EventHandler(reallink_DataBinding)).w_ctrl : new label(new EventHandler(real_DataBinding)).lbl; } else if (_typeCtrl == TypeTemplateCol.check) { ctrl = new check(_page.newIdControl, new EventHandler(check_DataBinding), false).w_ctrl; } else if (_typeCtrl == TypeTemplateCol.date || _typeCtrl == TypeTemplateCol.date_hour) { if (refItem() != null) { throw new Exception("refitem non supportato per la colonna 'date'"); } else { ctrl = new label(new EventHandler(date_DataBinding)).lbl; } } else if (_typeCtrl == TypeTemplateCol.link) { ctrl = new link(new EventHandler(link_DataBinding)).w_ctrl; } else if (_typeCtrl == TypeTemplateCol.action) { notTransparent = true; ctrl = new link(new EventHandler(action_DataBinding), _icon + " icon-btn").w_ctrl; } else if (_typeCtrl == TypeTemplateCol.action_url) { notTransparent = true; ctrl = new link(new EventHandler(actionurl_DataBinding), _icon + " icon-btn").w_ctrl; } else if (_typeCtrl == TypeTemplateCol.request) { notTransparent = true; ctrl = new link(new EventHandler(request_DataBinding), _icon + " icon-btn").w_ctrl; } else if (_typeCtrl == TypeTemplateCol.tabledel) { notTransparent = true; ctrl = new link(new EventHandler(requestDel_DataBinding), _icon + " icon-btn").w_ctrl; } else if (_typeCtrl == TypeTemplateCol.tablelink) { notTransparent = true; ctrl = new link(new EventHandler(requestLink_DataBinding), _icon + " icon-btn").w_ctrl; } else { throw new Exception("campo '" + _typeCtrl.ToString() + "' non supportato!"); } // aggiunta controllo alla griglia if (ctrl != null) { if (_typeCtrl == TypeTemplateCol.action || _typeCtrl == TypeTemplateCol.action_url || _typeCtrl == TypeTemplateCol.request || _typeCtrl == TypeTemplateCol.tabledel || _typeCtrl == TypeTemplateCol.tablelink) { ctrl.ToolTip = _col_des; } if (xmlDoc.node_bool(_colNode, "show_title")) { ctrl.Attributes.Add("show_title", "true"); } ctrl.Style.Add(HtmlTextWriterStyle.Width, "95%"); if (!notTransparent) { ctrl.Style.Add(HtmlTextWriterStyle.BackgroundColor, "transparent"); } container.Controls.Add(ctrl); } } break; case ListItemType.EditItem: //... break; case ListItemType.Footer: { _iField++; // creazione del controllo WebControl ctrl = null; if (_typeCtrl == TypeTemplateCol.euro) { ctrl = new label(new EventHandler(eurosum_DataBinding)).lbl; } else if (_typeCtrl == TypeTemplateCol.real) { ctrl = new label(new EventHandler(realsum_DataBinding)).lbl; } else { throw new Exception("campo '" + _typeCtrl.ToString() + "' non supportato!"); } // aggiunta controllo alla griglia if (ctrl != null) { ctrl.ToolTip = _col_des; ctrl.Style.Add(HtmlTextWriterStyle.Width, "95%"); ctrl.Style.Add(HtmlTextWriterStyle.BackgroundColor, "transparent"); container.Controls.Add(ctrl); } } break; } }