Пример #1
0
    // Use this for initialization
    void Start()
    {
        rcd         = DataManager.recordComponent;
        wordRecords = rcd.records;

        wordViewPos    = wordView.transform.position;
        recordsViewPos = recordsView.transform.position;
        timeViewPos    = timeView.transform.position;
        avgViewPos     = avgView.transform.position;

        shiftRate = Vector3.zero;

        wordList  = rcd.database.getWords();
        totalNum  = wordList.Count;
        recordNum = wordRecords.Length;
        recordNow = 0;

        loaded  = false;
        isdown  = false;
        istouch = false;

        //init size
        float w = Screen.width * 3 / 5;

        wordView.pixelInset = new Rect(-w * 0.5f, -w * 0.5f, w, w);
        //print("w=" + Screen.width);
        wordViewNW = new Vector2(w / Screen.width, w / Screen.height);

        w = Screen.width / 5f;

        LarrowT.pixelInset = new Rect(-w * 0.5f, -w * 0.5f, w, w);
        RarrowT.pixelInset = new Rect(-w * 0.5f, -w * 0.5f, w, w);
        DarrowT.pixelInset = new Rect(-w * 0.5f, -w * 0.5f, w, w);
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        rcd = GameObject.Find("GlobalRecord").GetComponent <GlobalRecord>();

        canvas          = GameObject.Find("Canvas").GetComponent <Canvas>();
        wordDisplay     = canvas.frontDisplay;
        backWordDisplay = canvas.backDisplay;
        showE           = 0.0f;

        isGameOver = false;

        // receive database
        db = rcd.database;

        // load words
        LoadWords(db);

        mainWord     = GameObject.Find("mainWord");
        battle       = GameObject.Find("Camera").GetComponent <t_BattleSystem>();
        barHP        = GameObject.Find("Camera").GetComponent <HorizontalBar>();
        blur         = GameObject.Find("Camera").GetComponent <BlurEffect>();
        blur.enabled = false;

        isDead = false;

        // initial
        Initial();

        levelNum = 3;
        levelNow = 1;
    }
Пример #3
0
        public EditorContext(VisualElement hostElement, GlobalRecord globals, ReactScript script, IDispatcher dispatcher, IUnityScheduler scheduler, bool isDevServer, Action onRestart = null)
            : base(globals, script, dispatcher, scheduler, isDevServer, onRestart, true)
        {
            Host = new HostComponent(hostElement, this);
            InsertStyle(EditorResourcesHelper.UseragentStylesheet?.text, -1);
            Host.ResolveStyle(true);

            hostElement.styleSheets.Add(EditorResourcesHelper.UtilityStylesheet);
        }
Пример #4
0
 public ReactUnityElement(ReactScript script, GlobalRecord globals, bool autorun = true)
 {
     Script  = script;
     Globals = globals;
     AddToClassList("react-unity__host");
     if (autorun)
     {
         Run();
     }
 }
Пример #5
0
        public ReactContext(GlobalRecord globals, ReactScript script, IDispatcher dispatcher,
                            IUnityScheduler scheduler, bool isDevServer, Action onRestart, bool mergeLayouts = false)
        {
            Globals           = globals;
            Script            = script;
            IsDevServer       = isDevServer;
            Scheduler         = scheduler;
            Dispatcher        = dispatcher;
            OnRestart         = onRestart ?? (() => { });
            this.mergeLayouts = mergeLayouts;
            Location          = new Location(this);

            Parser    = new StylesheetParser(true, true, true, true, true);
            StyleTree = new StyleTree(Parser);
        }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     if (Instance == null)
     {
         Instance        = this;
         modelComponent  = this.GetComponentInChildren <model>();
         recordComponent = this.GetComponentInChildren <GlobalRecord>();
         this.enabled    = false;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Debug.Log("DataManager is already exists");
         Destroy(this.gameObject);
     }
 }
Пример #7
0
        public UGUIContext(RectTransform hostElement, GlobalRecord globals, ReactScript script, IDispatcher dispatcher, IUnityScheduler scheduler, bool isDevServer, Action onRestart)
            : base(globals, script, dispatcher, scheduler, isDevServer, onRestart)
        {
            Host           = new HostComponent(hostElement, this);
            RootLayoutNode = Host.Layout;

            InsertStyle(ResourcesHelper.UseragentStylesheet?.text, -1);
            Host.ResolveStyle(true);

            Action callback = () =>
            {
                if (LayoutScheduled)
                {
                    RootLayoutNode.CalculateLayout();
                    LayoutScheduled = false;
                }
            };

            dispatcher.OnEveryLateUpdate(callback);
        }
Пример #8
0
    // Use this for initialization
    void Start()
    {
        canvas          = GameObject.Find("Canvas").GetComponent <Canvas>();
        wordDisplay     = canvas.frontDisplay;
        backWordDisplay = canvas.backDisplay;
        showE           = 0.0f;
        showError       = true;
        playedTimer     = 0.0f;
        toggleWaterMark = false;

        // get global record and database
        //GameObject o = GameObject.Find("GlobalRecord");
        //rcd = o.GetComponent<GlobalRecord>();
        rcd = DataManager.recordComponent;
        //o = GameObject.Find("database");
        //db = o.GetComponent<model>();
        db = DataManager.modelComponent;

        // load words
        LoadWords();

        check = false;
    }