Class for holding game strings and returning formatted strings and text
Inheritance: UWEBase
Exemple #1
0
 void Awake()
 {
     StringControl = new StringController();
     StringController.instance.InitStringController("c:\\shock_strings.txt");
     //Debug.Log (StringController.instance.GetString (2151,037));
     Words.sc = StringControl;
 }
Exemple #2
0
    public void Populate()
    {
        Thruster = (GameObject)Instantiate(Resources.Load(StringController.GetInstance().Resource_MainThruster_DebugMainThruster));

        Thruster.transform.parent        = this.transform;
        Thruster.transform.localPosition = Vector3.zero;
    }
 void Awake()
 {
     StringControl=new StringController();
     StringController.instance.InitStringController("c:\\shock_strings.txt");
     //Debug.Log (StringController.instance.GetString (2151,037));
     Words.sc=StringControl;
 }
Exemple #4
0
 // Singleton functionality
 public static StringController GetInstance()
 {
     if (instance == null)
     {
         instance = new StringController();
     }
     return(instance);
 }
    void Awake()
    {
        instance = this;
        //Set some default strings that differ between games.


        /*if(UWEBase._RES!="UW1")
         * {
         *      //InitStringController(Application.dataPath + "//..//" + UWEBase._RES + "_strings.txt");
         * }
         * else
         * {
         *      //use the new method
         *      //LoadStringsPak(Path);
         * }*/
    }
Exemple #6
0
        public static List <TokenModel> DoLexAn(string inputString)
        {
            var stringController = new StringController(inputString);
            var resList          = new List <TokenModel>();
            var tmp = new TokenModel("", -1);

            void AddTmpStr()
            {
                if (tmp.Index == -1)
                {
                    return;
                }
                resList.Add(tmp);
                tmp = new TokenModel("", -1);
            }

            while (stringController.TryGetNext(out var cc))
            {
                if (cc == ' ' || cc == '\r' || cc == '\n')
                {
                    AddTmpStr();
                    continue;
                }

                if (Constants.Symbols.Contains(cc))
                {
                    if (tmp.Index == -1)
                    {
                        tmp.Index = stringController.GetNextIndex() - 1;
                    }
                    tmp.Text += cc;
                    continue;
                }

                if (Constants.SpecialSymbols.Contains(cc) || Constants.ArifmeticalOperators.Contains(cc))
                {
                    AddTmpStr();
                    resList.Add(new TokenModel(cc.ToString(), stringController.GetNextIndex() - 1));
                    continue;
                }

                throw new ParseException($"Unknown symbol - '{cc}'", new TokenModel(cc.ToString(), stringController.GetNextIndex() - 1));
            }
            AddTmpStr();
            return(resList);
        }
Exemple #7
0
    public Strum(Vector2 startPos)
    {
        _pos = startPos;

        foreach (StringController s in StringsManager.Singleton.Strings)
        {
            if (s.IsOverString(_pos))
            {
                // dont wait for release when muting
                if (s.IsMuted)
                {
                    s.Play();
                    _lastPlayed = s;
                }
                break;
            }
        }
    }
Exemple #8
0
    public void Update(Vector2 newPos)
    {
        if (_hoverString != null && !_hoverString.IsOverString(newPos))
        {
            _hoverString = null;
        }

        foreach (StringController s in StringsManager.Singleton.Strings)
        {
            if (s.IntersectsString(_pos, newPos))
            {
                s.Play();
                _lastPlayed = s;
            }
            else if (s.IsOverString(newPos))
            {
                _hoverString = s;
            }
        }

        _pos = newPos;
    }
        public ActionResult GameLogin()
        {
            try
            {
                if (!StringController.IsEmpty(Request.Form["NameInput"]) && !StringController.IsEmpty(Request.Form["GameKey"]))
                {
                    CurrentGame = new Game(Request.Form["Gamekey"]);
                    if (CurrentGame.InsertPlayer(Request.Form["NameInput"], Game._IsAdmin.NO))
                    {
                        HttpCookie[] cookie = new HttpCookie[] { new HttpCookie("GameKey"), new HttpCookie("Player"), new HttpCookie("AuthID") };
                        string       authId = Guid.NewGuid().ToString();
                        cookie[0].Value   = CurrentGame.GetGameKey;
                        cookie[1].Value   = CurrentGame._CurrentPlayer.Nickname;
                        cookie[2].Value   = authId;
                        Session["AuthID"] = authId;
                        foreach (HttpCookie c in cookie)
                        {
                            Response.Cookies.Add(c);
                        }
                        /*new { GameKey= CurrentGame.GetGameKey, Player = CurrentGame._CurrentPlayer.Nickname }*/

                        return(RedirectToAction("GameLobby", "Home"));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Home"));
                    }
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
            catch (Exception e)
            {
                string message = e.ToString();
                return(RedirectToAction("NewGame", "Home"));
            }
        }
Exemple #10
0
    // Use this for initialization
    void Start()
    {
        StringControl = new StringController();
        StringControl.InitStringController("c:\\uw1_strings.txt");
        //Initialise some basic references on other objects.
        //ObjectInteraction.player=this.gameObject;//Set the player controller for all interaction scripts.
        //ObjectInteraction.SC=StringControl;
        //a_text_string_trap.SC=StringControl;
        //	ButtonHandler.SC=StringControl;
        //ObjectInteraction.SC = GameObject.Find ("StringController").GetComponent<StringController>();
        //ButtonHandler.player=this.gameObject;
        //InventorySlot.player=this.gameObject;
        InventorySlot.playerUW  = this.GetComponent <UWCharacter>();
        ActiveRuneSlot.playerUW = this.GetComponent <UWCharacter>();
        RuneSlot.playerUW       = this.GetComponent <UWCharacter>();

        //TODO:Shock character
        //WindowDetect.playerUW=this.GetComponent<UWCharacter>();

        XAxis             = GetComponent <MouseLook>();
        YAxis             = transform.FindChild("Main Camera").GetComponent <MouseLook>();
        Screen.lockCursor = true;

        MessageLog = (UILabel)GameObject.FindWithTag("MessageLog").GetComponent <UILabel>();

        //Debug.Log ("Setting player to " + this.gameObject);
        //Cursor.SetCursor (CursorIcon,Vector2.zero, CursorMode.ForceSoftware);
        //ObjectInteraction.player=this.gameObject;//Set the player controller for all interaction scripts.
        //InventorySlot.player=this.gameObject;
        //InventorySlot.playerUW=this.GetComponent<UWCharacter>();
        //CursorIcon=(Texture2D)Resources.Load("Assets/HUD/cursors/cursors_0000.tga",typeof(Texture2D));
        //Debug.Log ("the player is " + ObjectInteraction.player.name);
        Cursor.SetCursor(CursorIconBlank, Vector2.zero, CursorMode.ForceSoftware);
        //Rect Position = new Rect(Event.current.mousePosition.x-cursorSizeX/2,Event.current.mousePosition.y-cursorSizeY/2,cursorSizeX,cursorSizeY);
        //GUI.DrawTexture (Position,CursorIcon);
    }
    //The message log on the main screen.
    //private Text MessageLog;
    // Use this for initialization
    void Start()
    {
        StringControl=new StringController();
        StringController.instance.InitStringController("c:\\uw1_strings.txt");
        //Initialise some basic references on other objects.
        //ObjectInteraction.player=this.gameObject;//Set the player controller for all interaction scripts.
        //ObjectInteraction.SC=StringControl;
        //a_text_string_trap.SC=StringControl;
        //	ButtonHandler.SC=StringControl;
        //ObjectInteraction.SC = GameObject.Find ("StringController").GetComponent<StringController>();
        //ButtonHandler.player=this.gameObject;
        //InventorySlot.player=this.gameObject;
        //InventorySlot.playerUW=this.GetComponent<UWCharacter>();
        //ActiveRuneSlot.playerUW=this.GetComponent<UWCharacter>();
        //RuneSlot.playerUW=this.GetComponent<UWCharacter>();

        //TODO:Shock character
        //WindowDetect.playerUW=this.GetComponent<UWCharacter>();

        XAxis = GetComponent<MouseLook>();
        YAxis =	transform.FindChild ("Main Camera").GetComponent<MouseLook>();
        //Screen.lockCursor=true;

            //	MessageLog = (Text)GameObject.FindWithTag("MessageLog").GetComponent<Text>();

        //Debug.Log ("Setting player to " + this.gameObject);
        //Cursor.SetCursor (CursorIcon,Vector2.zero, CursorMode.ForceSoftware);
        //ObjectInteraction.player=this.gameObject;//Set the player controller for all interaction scripts.
        //InventorySlot.player=this.gameObject;
        //InventorySlot.playerUW=this.GetComponent<UWCharacter>();
        //CursorIcon=(Texture2D)Resources.Load("Assets/HUD/cursors/cursors_0000.tga",typeof(Texture2D));
        //Debug.Log ("the player is " + ObjectInteraction.player.name);
        Cursor.SetCursor (CursorIconBlank,Vector2.zero, CursorMode.ForceSoftware);
        //Rect Position = new Rect(Event.current.mousePosition.x-cursorSizeX/2,Event.current.mousePosition.y-cursorSizeY/2,cursorSizeX,cursorSizeY);
        //GUI.DrawTexture (Position,CursorIcon);
    }
 void Awake()
 {
     instance=this;
         InitStringController(Application.dataPath + "//..//" + UWEBase._RES + "_strings.txt");
 }
Exemple #13
0
 // Use this for initialization
 void Start()
 {
     stringcontrol = new StringController();
     stringcontrol.LoadStringsPak(StringsPath);
     LoadCnvArk(Path);
 }
Exemple #14
0
    public void TestStringLoader()
    {
        StringController sc = new StringController();

        sc.LoadShockStrings("c:\\games\\systemshock\\res\\data\\CYBSTRNG.RES");
    }