// Going from left to right, place one element at a time, then return the next legal element offset public override float PositionElements() { // Place column elements float nextElementX = -1 * (GetComponent <RectTransform>().sizeDelta.x / 2) + edgeMargin; for (int colIndex = 0; colIndex < content.Count; colIndex++) { GameObject col = content[colIndex]; float halfElementWidth = col.GetComponent <RectTransform>().rect.width / 2; TextBoxController rowTBC = col.GetComponent <TextBoxController>(); if (rowTBC != null) { halfElementWidth = rowTBC.GetEffectiveSize().x / 2; } nextElementX += halfElementWidth; col.transform.localPosition = new Vector2(nextElementX, 0f); nextElementX += halfElementWidth; // Add either row margin or edge margin depending on if we are at the top element if (colIndex >= content.Count - 1) { nextElementX += edgeMargin; } else { nextElementX += contentMargin; } } return(nextElementX); }
/// <summary> /// Standard constructor. See also static <seealso cref="LoadFile"/> method /// for construction from file saved on disk. /// </summary> protected EdiViewModel() : base(DocumentKey) { CloseOnErrorWithoutMessage = false; // Copy text editor settings from settingsmanager by default TextOptions = new ICSharpCode.AvalonEdit.TextEditorOptions(); WordWrap = false; var items = new ObservableCollection <UnitComboLib.Models.ListItem>(Options.GenerateScreenUnitList()); SizeUnitLabel = UnitComboLib.UnitViewModeService.CreateInstance(items, new ScreenConverter(), 0); TxtControl = new TextBoxController(); FilePath = GetDefaultFileNewName(); IsDirty = false; _mHighlightingDefinition = null; _mDocument = null; //new TextDocument(); TextEditorSelectionStart = 0; TextEditorSelectionLength = 0; InsertBlocks = null; }
protected virtual void Start() { sceneController = FreeRoamSceneController.GetFreeRoamSceneController(gameObject.scene); textBoxController = TextBoxController.GetTextBoxController(gameObject.scene); RefreshGridPositions(); }
protected void Start() { endLevel = false; if (distance == 0) { distance = .5f; } speed = .008f; //path to current folder text textPath = SceneManager.GetActiveScene().name + "/" + name; currentConversation = -1; //loads lines of conversations into an array conversations = createDialogue(loadText(textPath)); //object seeker stuff here if (wantedItem == "") { receivedItem = true; } anim = gameObject.GetComponent <Animator>(); talkedOnce = false; talked = false; triggered = false; tc = GameObject.Find("GameManager").GetComponent <TextBoxController>(); }
private void Awake() { opened = false; animator = GetComponent <Animator>(); tb = GameObject.FindGameObjectWithTag("GameManager").GetComponent <TextBoxController>(); bc = GetComponent <BoxCollider2D>(); }
void Awake() { FadeImg.rectTransform.localScale = new Vector2(Screen.width, Screen.height); tc = GameObject.Find("GameManager").GetComponent <TextBoxController>(); pc = GameObject.Find("Player").GetComponent <PlayerController>(); qm = GameObject.Find("GameManager").GetComponent <QuitManager>(); }
// Use this for initialization void Awake() { player = GameObject.Find("Player"); pc = player.GetComponent <PlayerController>(); inv = GameObject.Find("GameManager").GetComponent <Inventory>(); tc = GameObject.Find("GameManager").GetComponent <TextBoxController>(); }
public static void CreateTextBoxes(string[] contents) { TextBoxController prototype = Resources.Load <TextBoxController>("TextBoxController"); TextBoxController textboxes = Instantiate(prototype); textboxes.textBoxContents = contents; }
private void Start() { textBoxController = TextBoxController.GetTextBoxController(gameObject.scene); controlEnabled = true; pointer.SetMenuController(this); boxAreaController.SetPointerGameObject(pointer); partyAreaController.SetPointerGameObject(pointer); closeButton.SetPointerGameObject(pointer); boxAreaController.SetUp(this); partyAreaController.SetUp(this); closeButton.OnClick.AddListener(() => { if (controlEnabled) { CloseMenu(); } }); SetCurrentBoxIndex(0); RefreshPartyPokemon(); SelectDefaultEventSystemGameObject(); }
// Going from bottom to top, place one element at a time, then return the next legal element offset public override float PositionElements() { // Place row elements float nextElementY = -1 * (rt.sizeDelta.y / 2) + edgeMargin; for (int rowIndex = content.Count - 1; rowIndex >= 0; rowIndex--) { GameObject row = content[rowIndex]; float halfElementHeight = row.GetComponent <RectTransform>().rect.height / 2; TextBoxController rowTBC = row.GetComponent <TextBoxController>(); if (rowTBC != null) { halfElementHeight = rowTBC.GetEffectiveSize().y / 2; } nextElementY += halfElementHeight; row.transform.localPosition = new Vector2(0f, nextElementY); nextElementY += halfElementHeight; // Add either row margin or edge margin depending on if we are at the top element if (rowIndex <= 0) { nextElementY += edgeMargin; } else { nextElementY += contentMargin; } } return(nextElementY); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(startKey) && currentTextBox == null) { currentTextBox = Instantiate(textBoxPrefab, canvas.transform).GetComponent <TextBoxController>(); currentTextBox.Enqueue(dialogue); } }
public void InitTbController() { TextBox tb = _controls.Find(ctrl => ctrl.Name == "CtrlViewTBLink") as TextBox; _linkCtrl = new TextBoxController(tb, ChangeLocker, ErrorHandler, QueryFactory.Queries.SelectLinkByRecipeName); tb = _controls.Find(ctrl => ctrl.Name == "CtrlViewTBText") as TextBox; _textCtrl = new TextBoxController(tb, ChangeLocker, ErrorHandler, QueryFactory.Queries.SelectTextByRecipeName); }
/// <summary>Hidden Class constructor</summary> protected DiffSideTextViewModel() { Document = new TextDocument(string.Empty); _TxtControl = new TextBoxController(); _Line = _Column = 1; TextEncoding = Encoding.Default; }
void OnTriggerEnter2D(Collider2D c) { if (c.tag != "Player") { return; } TextBoxController.CreateTextBoxes(textboxesContents); Destroy(gameObject); }
void OpenBook() { openbook.Invoke(); string componentString = LanguageManager.Singleton.components.GetAlienByIndex(id) + " = " + LanguageManager.Singleton.components.GetTypeByIndex(id) + " component"; string socketString = LanguageManager.Singleton.sockets.GetAlienByIndex(id) + " = " + LanguageManager.Singleton.sockets.GetTypeByIndex(id) + " socket"; TextBoxController.ChangeText(componentString + "\n" + socketString, false); bookOpen = true; SendItButton.SetActive(false); }
//Clicking ResetBtn will set reset to true so that when textBox change, it will not start timer again //This will reset the timer, clear the textBox, set readOnly for textBox to false, and switch visiblity of wordPerMin to false private void ResetBtn_Click(object sender, EventArgs e) { reset = true; TimerController.ResetTimer(time); TextBoxController.ClearTextBox(textBox); TextBoxController.SetReadOnly(textBox, false); accuracyController.SetVisibility(accuracy, false); WordPerMinController.SetVisibility(wordPerMinLabel, false); WordPerMinController.SetVisibility(wordPerMin, false); }
void Awake() { player = GameObject.Find("Player"); pc = player.GetComponent <PlayerController>(); sf = GameObject.Find("GameManager").GetComponent <ScreenFader>(); quitBox = GameObject.Find("QuitBox"); message = GameObject.Find("Message"); textController = GetComponent <TextBoxController>(); message.GetComponent <Text>().font = Resources.Load("Fonts/thefont") as Font; }
public RepairSet CreateRepairSetLocal() { int difficulty = DifficultyManager.Singleton.Difficulty; //Instantiate repairset GameObject rsObject = Instantiate(repairSetPrefab, repairSetHolder); RepairSet repairSet = rsObject.GetComponent <RepairSet>(); //Instantiate repairable object GameObject repairable = Instantiate(repairablePrefabs[Random.Range(0, repairablePrefabs.Length)], rsObject.transform); RepairableObject repairableObject = repairable.GetComponent <RepairableObject>(); //Instantiate components int nComponents = componentsPerLevel[difficulty]; SocketComponent[] components = new SocketComponent[nComponents]; GameObject[] prefabSelection = Utils.RandomSelection <GameObject>(componentPrefabs, nComponents); for (int i = 0; i < nComponents; ++i) { GameObject g = Instantiate(prefabSelection[i], rsObject.transform); components[i] = g.GetComponent <SocketComponent>(); //Place components in a circle around the repairable g.transform.localPosition = Quaternion.Euler(0f, 360 * i / nComponents, 0f) * (Vector3.left * componentRadius) + Vector3.up * .3f; } //Instantiate sockets int nSockets = socketsPerLevel[difficulty]; Socket[] sockets = new Socket[nSockets]; prefabSelection = Utils.RandomSelection <GameObject>(socketPrefabs, nSockets); string instructions = ""; for (int i = 0; i < nSockets; ++i) { GameObject g = Instantiate(prefabSelection[i]); sockets[i] = g.GetComponent <Socket>(); sockets[i].CorrectComponent = components[i].componentType; string ComponentString = LanguageManager.Singleton.components.TranslateToAlien(components[i].componentType); string SocketString = LanguageManager.Singleton.sockets.TranslateToAlien(sockets[i].SocketType); instructions += ComponentString + " -> " + SocketString + "\n"; } TextBoxController.ChangeText(instructions); //Attach sockets repairableObject.AddRandomSockets(sockets); //Set references repairSet.SetReferences(repairableObject, sockets, components); return(repairSet); }
void Awake() { player = GameObject.Find("Player"); pc = player.GetComponent <PlayerController>(); inv = GetComponent <Inventory>(); menuBox = GameObject.Find("MenuBox"); menu = GameObject.Find("Menu"); textController = GetComponent <TextBoxController>(); menu.GetComponent <Text>().font = Resources.Load("Fonts/thefont") as Font; map = GameObject.Find("Map"); }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } dialogue_Text = transform.Find("Dialogue_Text").GetComponent <DialogueText>(); }
// Use this for initialization void Start() { if (hugDistance == 0) { hugDistance = .5f; } player = GameObject.Find("Player"); hugged = false; an = GetComponent <Animator>(); tc = GameObject.Find("GameManager").GetComponent <TextBoxController>(); inv = GameObject.Find("GameManager").GetComponent <Inventory>(); triggered = false; tr = GameObject.Find("GameManager").GetComponent <TransitionController>(); }
private void Start() { TextBoxController[] textBoxControllerCandidates = FindObjectsOfType <TextBoxController>() .Where(x => x.gameObject.scene == gameObject.scene) .ToArray(); if (textBoxControllerCandidates.Length == 0) { Debug.LogError("No valid TextBoxController found"); } else { textBoxController = textBoxControllerCandidates[0]; } }
/// <summary> /// Initialize a new instance of the ViewDrawRibbonGroupTextBox class. /// </summary> /// <param name="ribbon">Reference to owning ribbon control.</param> /// <param name="ribbonTextBox">Reference to source textbox.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public ViewDrawRibbonGroupTextBox(KryptonRibbon ribbon, KryptonRibbonGroupTextBox ribbonTextBox, NeedPaintHandler needPaint) { Debug.Assert(ribbon != null); Debug.Assert(ribbonTextBox != null); Debug.Assert(needPaint != null); // Remember incoming references _ribbon = ribbon; GroupTextBox = ribbonTextBox; _needPaint = needPaint; _currentSize = GroupTextBox.ItemSizeCurrent; // Hook into the textbox events GroupTextBox.MouseEnterControl += OnMouseEnterControl; GroupTextBox.MouseLeaveControl += OnMouseLeaveControl; // Associate this view with the source component (required for design time selection) Component = GroupTextBox; if (_ribbon.InDesignMode) { // At design time we need to know when the user right clicks the textbox ContextClickController controller = new(); controller.ContextClick += OnContextClick; MouseController = controller; } // Create controller needed for handling focus and key tip actions _controller = new TextBoxController(_ribbon, GroupTextBox, this); SourceController = _controller; KeyController = _controller; // We need to rest visibility of the textbox for each layout cycle _ribbon.ViewRibbonManager.LayoutBefore += OnLayoutAction; _ribbon.ViewRibbonManager.LayoutAfter += OnLayoutAction; // Define back reference to view for the text box definition GroupTextBox.TextBoxView = this; // Give paint delegate to textbox so its palette changes are redrawn GroupTextBox.ViewPaintDelegate = needPaint; // Hook into changes in the ribbon custom definition GroupTextBox.PropertyChanged += OnTextBoxPropertyChanged; NULL_CONTROL_WIDTH = (int)(50 * FactorDpiX); }
void Start() { controller = GameObject.Find("TextCanvas").GetComponent <TextBoxController>(); if (hasText) { transmission = Transmission.ParseMessageText(textAsset.text); } if (hasAudio) { audioSource = GetComponent <AudioSource>(); } circleCollider = GetComponent <CircleCollider2D>(); commLightSwitcher = GameObject.Find("CommsLight").GetComponent <SpriteSwitcher>(); console = GameObject.Find("ConsoleControlsCanvas").GetComponent <ConsoleController>(); signalBar = GameObject.Find("SignalBar").GetComponent <Image>(); }
/// <summary> /// Class constructor /// </summary> public DiffSideViewModel() { _position = new DiffViewPosition(0, 0); _DocLineDiffsLock = new object(); _DocLineDiffs = new ObservableRangeCollection <IDiffLineViewModel>(); BindingOperations.EnableCollectionSynchronization(_DocLineDiffs, _DocLineDiffsLock); _Line = 0; _Column = 0; _TxtControl = new TextBoxController(); _ViewActivation = DateTime.MinValue; _oneTaskScheduler = new OneTaskLimitedScheduler(); }
public override float PositionElements() { float virtualEdgeMargin = edgeMargin * scaleVector.y; float virtualContentMargin = contentMargin * scaleVector.y; // A lot like the column layout version, but with the target panel size instead of the actual window size float nextElementY = -1 * (parentPC.panelSize.y / 2) + virtualEdgeMargin; for (int rowIndex = content.Count - 1; rowIndex >= 0; rowIndex--) { GameObject row = content[rowIndex]; float halfElementHeight = row.GetComponent <RectTransform>().rect.height / 2 * scaleVector.y; TextBoxController rowTBC = row.GetComponent <TextBoxController>(); if (rowTBC != null) { halfElementHeight = rowTBC.GetEffectiveSize().y / 2 * scaleVector.y; } nextElementY += halfElementHeight; row.transform.localPosition = new Vector2(0f, nextElementY); // Re-scale each element to fill the panel LayoutController rowLC = row.GetComponent <LayoutController>(); if (rowLC != null) { rowLC.ScaleToFit(scaleVector); } else { row.transform.localScale = scaleVector; } nextElementY += halfElementHeight; // Add either row margin or edge margin depending on if we are at the top element if (rowIndex <= 0) { nextElementY += virtualEdgeMargin; } else { nextElementY += virtualContentMargin; } } return(nextElementY); }
/// <summary> /// Биндинг текстового бокса. /// </summary> private IUserControlController BindTextBox(PropertyInfo propertyInfo, IControlDescriptor control) { var controller = new TextBoxController(); controller.SetView((TextBoxControl)control); ProcessCommon(controller.Model, propertyInfo); var attr = GetAttribute <RegexValueAttribute>(propertyInfo); if (attr != null) { controller.Model.RegexText = attr.Regex; } return(controller); }
override public bool Activate() { if (deconstructerSource == null) { GameObject textbox = Resources.Load <GameObject>("TextBox"); spawnedTextBox = Instantiate <GameObject>(textbox, new Vector3(parent.transform.position.x, parent.transform.position.y + heightOverSpeaker, parent.transform.position.z + 0.2f), Quaternion.identity); TextBoxController tb_controller = spawnedTextBox.GetComponent <TextBoxController>(); tb_controller.textfile = inputText; tb_controller.letter_noises = letter_noises; tb_controller.letters_per_noise_list = letters_per_noise_list; } else { DialogueNodeRead(); } return(true); }
private void Start() { HideMenu(); itemDetailsController.SetItem(null, false); //Second parameter doesn't matter if setting as null itemsListController.SetUp(fullBorderPrefab, (index) => OnItemSelected(index)); itemsListController.itemIndexSelected.RemoveAllListeners(); itemsListController.itemIndexSelected.AddListener(index => SetCurrentSelectionIndex(index)); RefreshPlayerMoneyText(); if (buttonBack.GetComponent <MenuSelectableController>() == null) { Debug.LogError("No MenuSelectableController on back button"); } buttonBack.onClick.RemoveAllListeners(); buttonBack.onClick.AddListener(BackButtonPressed); textBoxController = TextBoxController.GetTextBoxController(gameObject.scene); }
// Get dimensions of content as if there were no margins public override Vector2 ContentDimensions() { float contentWidth = 0f; float contentHeight = 0f; foreach (GameObject row in content) { TextBoxController rowTBC = row.GetComponent <TextBoxController>(); Vector2 rowSize = row.GetComponent <RectTransform>().sizeDelta; if (rowTBC != null) { rowSize = rowTBC.GetEffectiveSize(); } contentWidth = Mathf.Max(contentWidth, rowSize.x); contentHeight += rowSize.y; } return(new Vector2(contentWidth, contentHeight)); }