コード例 #1
0
    private void setGlyph(clGlyph foundGlyph)
    {
        foreach (KeyValuePair <int, GameObject> item in lstSeg)
        {
            item.Value.SetActive(false);
        }

        for (int i = 0; i < foundGlyph.pattern.Length; i++)
        {
            if (lstSeg.ContainsKey(foundGlyph.pattern[i]))
            {
                lstSeg[foundGlyph.pattern[i]].SetActive(true);
            }
        }
    }
コード例 #2
0
    internal msgResponse treatMessage(JToken data)
    {
        if (data["glyph"] != null)
        {
            JToken prevJ = data["glyph"]["circles"].First;
            if (prevJ == null)
            {
                return(msgResponse.BadGlyph);
            }
            JToken           curJ   = prevJ.Next;
            List <clSegment> lstSeg = new List <clSegment>();

            while (curJ != null)
            {
                lstSeg.Add(new clSegment(prevJ.Value <int>("id"), curJ.Value <int>("id")));
                prevJ = curJ;
                curJ  = curJ.Next;
            }

            lstSeg.Sort();
            for (int i = 1; i < lstSeg.Count; i++)
            {
                if (lstSeg[i - 1].id == lstSeg[i].id)
                {
                    lstSeg.RemoveAt(i);
                    i--;
                }
            }

            string s = "";
            for (int i = 0; i < lstSeg.Count; i++)
            {
                s += lstSeg[i].id + ",";
            }

            int[] r = new int[lstSeg.Count];
            for (int i = 0; i < r.Length; i++)
            {
                r[i] = lstSeg[i].id;
            }

            lastGlyph = getGlyph(r);

            if (lastGlyph == null)
            {
                AirConsole.instance.Message(deviceId, "@" + Lng.NotAGlyph);
                Debug.Log(s);
                return(msgResponse.BadGlyph);
            }
            else
            {
                AirConsole.instance.Message(deviceId, "@" + lastGlyph.name);
                return(msgResponse.GoodGlyph);
            }
        }
        else
        {
            Debug.Log("Message from player " + player + " " + data.ToString());
        }
        return(msgResponse.None);
    }