Exemplo n.º 1
0
    public void Display(int i)
    {
        GameObject uiObj = GameObject.Find("General UI");
        UiScript   ui    = uiObj.GetComponent <UiScript>();

        ui.Display(List[i].title, List[i].desc);
    }
Exemplo n.º 2
0
 void Start()
 {
     _uiScript = FindObjectOfType <UiScript>();
     _canJump  = Random.Range(0, 2) == 0;             //50 50 chance to jump
     _enemyRB  = GetComponent <Rigidbody2D>();
     _speed   += _uiScript.ReturnScoreFloat() / 110f; //was 125            //see UiScript.ReturnScoreFloat
 }
Exemplo n.º 3
0
 public ResultsRenderer(string lang, CedictLookupResult lr, UiScript uiScript, UiTones uiTones)
 {
     this.lang     = lang;
     this.lr       = lr;
     this.uiScript = uiScript;
     this.uiTones  = uiTones;
 }
Exemplo n.º 4
0
 private void determineCookieOptions()
 {
     if (Request.Cookies["uiscript"] != null)
     {
         if (Request.Cookies["uiscript"].Value == "both")
         {
             uiScript = UiScript.Both;
         }
         else if (Request.Cookies["uiscript"].Value == "simp")
         {
             uiScript = UiScript.Simp;
         }
         else if (Request.Cookies["uiscript"].Value == "trad")
         {
             uiScript = UiScript.Trad;
         }
     }
     if (Request.Cookies["uitones"] != null)
     {
         if (Request.Cookies["uitones"].Value == "none")
         {
             uiTones = UiTones.None;
         }
         else if (Request.Cookies["uitones"].Value == "pleco")
         {
             uiTones = UiTones.Pleco;
         }
         else if (Request.Cookies["uitones"].Value == "dummitt")
         {
             uiTones = UiTones.Dummitt;
         }
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Ctor: dictionary entry in change history.
 /// </summary>
 public EntryRenderer(CedictEntry entry)
 {
     this.entryToRender    = entry;
     this.script           = UiScript.Both;
     this.tones            = UiTones.None;
     this.hanim            = false;
     this.dimIdenticalTrad = false;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Ctor: regular lookup result
 /// </summary>
 public OneResultCtrl(CedictResult res, ICedictEntryProvider prov,
                      UiScript script, UiTones tones, bool isMobile)
 {
     this.res      = res;
     this.prov     = prov;
     this.script   = script;
     this.tones    = tones;
     this.isMobile = isMobile;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Ctor: regular lookup result
 /// </summary>
 public EntryRenderer(CedictResult res, ICedictEntryProvider prov,
                      UiScript script, UiTones tones)
 {
     this.res              = res;
     this.prov             = prov;
     this.script           = script;
     this.tones            = tones;
     this.hanim            = true;
     this.dimIdenticalTrad = true;
 }
Exemplo n.º 8
0
 private void Awake()
 {
     if (Instance != null)
     {
         DestroyImmediate(gameObject);
         return;
     }
     Instance = this;
     DontDestroyOnLoad(gameObject);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Ctor: dictionary entry in change history.
 /// </summary>
 public EntryRenderer(string lang, CedictEntry entry, bool dimIdenticalTrad, string extraEntryClass = "")
 {
     this.lang             = lang;
     this.entryToRender    = entry;
     this.script           = UiScript.Both;
     this.tones            = UiTones.None;
     this.hanim            = false;
     this.dimIdenticalTrad = dimIdenticalTrad;
     this.extraEntryClass  = extraEntryClass;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Ctor: regular lookup result
 /// </summary>
 public EntryRenderer(string lang, CedictResult res, UiScript script, UiTones tones, string entryId)
 {
     this.lang             = lang;
     this.res              = res;
     this.script           = script;
     this.tones            = tones;
     this.hanim            = true;
     this.dimIdenticalTrad = true;
     this.entryId          = entryId;
     this.extraEntryClass  = "";
 }
Exemplo n.º 11
0
        public void LogQuery(string hostAddr, bool isMobile, string uiLang, UiScript script, UiTones tones,
                             int resCount, int msecLookup, int msecTotal, SearchMode smode, string query)
        {
            QueryItem itm = new QueryItem(ipResolver, hostAddr, isMobile, uiLang, script, tones,
                                          resCount, msecLookup, msecTotal, smode, query);

            lock (ilist)
            {
                ilist.Add(itm);
                evt.Set();
            }
        }
Exemplo n.º 12
0
        public void LogQuery(string countryCode, bool isMobile, string uiLang, UiScript script, UiTones tones,
                             int resCount, int msecLookup, int msecTotal, SearchMode smode, string query)
        {
            QueryItem itm = new QueryItem(countryCode, isMobile, getLangLetter(uiLang), script, tones,
                                          resCount, msecLookup, msecTotal, smode, query);

            lock (ilist)
            {
                ilist.Add(itm);
                evt.Set();
            }
        }
Exemplo n.º 13
0
 /// <summary>
 /// Ctor: reference entry in new entry editor
 /// </summary>
 /// <param name="entry">Entry to render.</param>
 /// <param name="hwTrad">New headword's traditional variant.</param>
 /// <param name="hwPinyin">New headword's pinyin.</param>
 public EntryRenderer(CedictEntry entry, string hwTrad, List <PinyinSyllable> hwPinyin)
 {
     this.entryToRender = entry;
     this.hwTrad        = hwTrad;
     if (hwPinyin != null)
     {
         this.hwPinyin = new List <PinyinSyllable>();
         this.hwPinyin.AddRange(hwPinyin);
     }
     this.script           = UiScript.Both;
     this.tones            = UiTones.None;
     this.hanim            = false;
     this.dimIdenticalTrad = false;
 }
Exemplo n.º 14
0
    void Start()
    {
        //Move();
        SpawnPosition = transform.position;
        uiScript      = FindObjectOfType <UiScript>();
        anim          = gameObject.GetComponent <Animator>();

        Dir           = Vector3.zero - transform.position;
        Dir           = Dir.normalized * 5;
        MoveDirection = Quaternion.LookRotation(Dir);

        Vector3 euler = MoveDirection.eulerAngles;

        euler.y += Random.Range(-15f, 15f);
        transform.eulerAngles = euler;
    }
Exemplo n.º 15
0
    void Awake()
    {
        uiScript = FindObjectOfType <UiScript>();
        // Set interactivity to be dependent on the Placement’s status:
        myButton.interactable = Advertisement.IsReady(myPlacementId);

        // Map the ShowRewardedVideo function to the button’s click listener:
        if (myButton)
        {
            myButton.onClick.AddListener(ShowRewardedVideo);
        }

        // Initialize the Ads listener and service:
        Advertisement.AddListener(this);
        //Advertisement.Initialize(gameId, true);
    }
Exemplo n.º 16
0
 public QueryItem(string countryCode, bool isMobile, char langLetter,
                  UiScript script, UiTones tones,
                  int resCount, int msecLookup, int msecTotal,
                  SearchMode smode, string query)
 {
     this.countryCode = countryCode;
     this.time        = DateTime.UtcNow;
     this.isMobile    = isMobile;
     this.langLetter  = langLetter;
     this.script      = script;
     this.tones       = tones;
     this.resCount    = resCount;
     this.msecLookup  = msecLookup;
     this.msecTotal   = msecTotal;
     this.smode       = smode;
     this.query       = query;
 }
Exemplo n.º 17
0
 public QueryItem(IpResolver ipr, string hostAddr, bool isMobile, string uiLang,
                  UiScript script, UiTones tones,
                  int resCount, int msecLookup, int msecTotal,
                  SearchMode smode, string query)
 {
     this.ipr        = ipr;
     this.time       = DateTime.UtcNow;
     this.hostAddr   = hostAddr;
     this.isMobile   = isMobile;
     this.uiLang     = uiLang;
     this.script     = script;
     this.tones      = tones;
     this.resCount   = resCount;
     this.msecLookup = msecLookup;
     this.msecTotal  = msecTotal;
     this.smode      = smode;
     this.query      = query;
 }
Exemplo n.º 18
0
        private PageResult doSearchInner(string rel, string lang, string searchScript, string searchTones,
                                         bool isMobile, out string query)
        {
            query = "";
            if (rel == "" || rel == "search" || rel == "search/")
            {
                return(doWelcome(lang));
            }

            Stopwatch swatch = new Stopwatch();

            swatch.Restart();
            PageResult pr;

            // Search settings
            UiScript uiScript = UiScript.Both;

            if (searchScript == "simp")
            {
                uiScript = UiScript.Simp;
            }
            else if (searchScript == "trad")
            {
                uiScript = UiScript.Trad;
            }
            UiTones uiTones = UiTones.Pleco;

            if (searchTones == "dummitt")
            {
                uiTones = UiTones.Dummitt;
            }
            else if (searchTones == "none")
            {
                uiTones = UiTones.None;
            }

            // Perform query
            query = rel.Replace("search/", "");
            query = query.Trim();
            query = WebUtility.UrlDecode(query);
            query = query.Trim();
            CedictLookupResult lr = dict.Lookup(query);
            int msecLookup        = (int)swatch.ElapsedMilliseconds;
            int msecFull          = msecLookup;

            // No results
            if (lr.Results.Count == 0 && lr.Annotations.Count == 0)
            {
                pr      = pageProvider.GetPage(lang, "?/noresults", false);
                pr.Data = query;
                // Can add word now?
                if (canAddWord(query))
                {
                    pr.Html = pr.Html.Replace("{addnowclass}", "visible");
                }
                else
                {
                    pr.Html = pr.Html.Replace("{addnowclass}", "");
                }
            }
            else
            {
                // Render results
                StringBuilder   sb = new StringBuilder();
                ResultsRenderer rr = new ResultsRenderer(lang, lr, uiScript, uiTones);
                rr.Render(sb, lang);
                // Title
                string title;
                if (lr.ActualSearchLang == SearchLang.Chinese)
                {
                    title = TextProvider.Instance.Mut == Mutation.CHD ?
                            TextProvider.Instance.GetString(lang, "misc.searchResultTitleCHD") :
                            TextProvider.Instance.GetString(lang, "misc.searchResultTitleHDD");
                }
                else
                {
                    title = TextProvider.Instance.Mut == Mutation.CHD ?
                            TextProvider.Instance.GetString(lang, "misc.searchResultTitleTrgCHD") :
                            TextProvider.Instance.GetString(lang, "misc.searchResultTitleTrgHDD");
                }
                title    = string.Format(title, query);
                msecFull = (int)swatch.ElapsedMilliseconds;
                // Wrap up
                pr = new PageResult
                {
                    RelNorm = rel,
                    Title   = title,
                    Html    = sb.ToString(),
                    Data    = query,
                };
            }
            // Query log
            string country;
            string xfwd = HttpContext.Request.Headers["X-Real-IP"];

            if (xfwd != null)
            {
                country = cres.GetContryCode(IPAddress.Parse(xfwd));
            }
            else
            {
                country = cres.GetContryCode(HttpContext.Connection.RemoteIpAddress);
            }
            int resCount = lr.Results.Count > 0 ? lr.Results.Count : lr.Annotations.Count;

            QueryLogger.SearchMode smode = QueryLogger.SearchMode.Target;
            if (lr.ActualSearchLang == SearchLang.Target)
            {
                smode = QueryLogger.SearchMode.Target;
            }
            else if (lr.Results.Count > 0)
            {
                smode = QueryLogger.SearchMode.Source;
            }
            else if (lr.Annotations.Count > 0)
            {
                smode = QueryLogger.SearchMode.Annotate;
            }
            qlog.LogQuery(country, isMobile, lang, uiScript, uiTones, resCount, msecLookup, msecFull, smode, query);
            // Done
            return(pr);
        }
Exemplo n.º 19
0
 void Awake()
 {
     Instance = this;
     SetScores(0, 0);
 }
Exemplo n.º 20
0
 private void Awake()
 {
     instance = this;
     captureText.gameObject.SetActive(false);
 }
Exemplo n.º 21
0
 void Awake()
 {
     uiScript = new UiScript();
     cnntStat = 0;
 }
Exemplo n.º 22
0
 void Awake()
 {
     instance = this;
 }
Exemplo n.º 23
0
        private void doSearch(string lang, string rel)
        {
            // No search query in URL: show welcome page.
            if (rel == "")
            {
                Res = makeWelcomeResult(lang);
                return;
            }

            // Seach's special parameters
            string   strScript = Req.Params["searchScript"];
            string   strTones  = Req.Params["searchTones"];
            UiScript uiScript  = UiScript.Both;

            if (strScript == "simp")
            {
                uiScript = UiScript.Simp;
            }
            else if (strScript == "trad")
            {
                uiScript = UiScript.Trad;
            }
            UiTones uiTones = UiTones.Pleco;

            if (strTones == "dummitt")
            {
                uiTones = UiTones.Dummitt;
            }
            else if (strTones == "none")
            {
                uiTones = UiTones.None;
            }

            // Perform query
            string query = rel.Replace("search/", "");

            query = HttpUtility.UrlDecode(query);
            CedictLookupResult lr;

            using (SqlDict.Query q = new SqlDict.Query())
            {
                lr = q.Lookup(query);
            }
            // No results
            if (lr.Results.Count == 0 && lr.Annotations.Count == 0)
            {
                return;
            }
            // Render results
            var           prov = lr.EntryProvider;
            StringBuilder sb   = new StringBuilder();

            using (HtmlTextWriter writer = new HtmlTextWriter(new StringWriter(sb)))
            {
                int max = Math.Min(lr.Results.Count, 256);
                for (int i = 0; i != max; ++i)
                {
                    var           lres = lr.Results[i];
                    EntryRenderer er   = new EntryRenderer(lres, prov, uiScript, uiTones);
                    er.OneLineHanziLimit = 9;
                    er.Render(writer);
                    if (i != max - 1)
                    {
                        writer.AddAttribute("class", "resultSep");
                        writer.RenderBeginTag(HtmlTextWriterTag.Div);
                        writer.RenderEndTag();
                    }
                }
            }
            // Assemble HTML for result
            StringBuilder sbHtml;
            string        title, keywords, description;

            readFile(getFileName(lang, "_search"), out sbHtml, out title, out keywords, out description);
            sbHtml.Replace("<!-- RESULTS -->", sb.ToString());
            // Special treatment of metainfo
            title = TextProvider.Instance.GetString(lang, "TitleSearchZho");
            title = string.Format(title, lr.Query);
            // Build result
            SearchResult res = new SearchResult();

            res.Html        = sbHtml.ToString();
            res.Title       = title;
            res.Keywords    = keywords;
            res.Description = description;
            res.Query       = lr.Query;
            Res             = res;
        }
Exemplo n.º 24
0
 // Use this for initialization
 void Start()
 {
     Instance = this;
 }
Exemplo n.º 25
0
 public void setUiScript(UiScript tUi)
 {
     ui = tUi;
 }