Ejemplo n.º 1
0
    void ShowTooltip(GameObject go)
    {
        UIButton btn = go.GetComponent <UIButton>();

        if (btn != null)
        {
            if (btn.data != null)
            {
                string text = "";
                if (btn.data is string)
                {
                    text = (string)btn.data;
                }
                else if (btn.data is HyperNpc)
                {
                    HyperNpc npc = (HyperNpc)btn.data;
                    text = npc.Name;
                }
                else if (btn.data is HyperAttack)
                {
                    HyperAttack attack = (HyperAttack)btn.data;
                    text = attack.Name;
                }

                if (text != "")
                {
                    CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_SUPERTOOLTIP, text);
                    lastWinName = go.name;
                }
            }
        }
    }
Ejemplo n.º 2
0
    // 解析杀怪超链接 [3/13/2012 Ivan]
    void ParseAttackLink(ref HyperLink link, ref string src)
    {
        //打怪超链接 eg:{#attack[sid,x,y,id]描述文字}
        Regex           rDic = new Regex(@"{#attack\[\d+,\d+,\d+,\d+\]\w*}");
        MatchCollection mc   = rDic.Matches(src);

        for (int i = 0; i < mc.Count; i++)
        {
            // Add the match string to the string array.
            string   fullText      = mc[i].Value;
            int      firstKeyIndex = fullText.IndexOf('[') + 1;
            int      lastKeyIndex  = fullText.IndexOf(']');
            string[] poss          = fullText.Substring(firstKeyIndex, lastKeyIndex - firstKeyIndex).Split(',');
            if (poss.Length != 4)
            {
                LogManager.LogError("超链接格式填写错误:" + fullText);
                continue;
            }

            int    descLength = fullText.IndexOf('}') - lastKeyIndex - 1;
            string desc       = fullText.Substring(lastKeyIndex + 1, descLength);
            // 将特定标示转换为显示文字
            src = src.Replace(fullText, hyperLinkColor + desc + Color.white);

            HyperAttack attack = new HyperAttack();
            attack.SceneId        = int.Parse(poss[0]);
            attack.PosTarget      = new UnityEngine.Vector3(float.Parse(poss[1]), 0, float.Parse(poss[2]));
            attack.TargetId       = int.Parse(poss[3]);
            attack.textCheck.Text = desc;
            link.allItems.Add(attack);
        }
    }
Ejemplo n.º 3
0
    private void ItemClick(GameObject go)
    {
        UIButton btn = go.GetComponent <UIButton>();

        if (btn != null)
        {
            if (btn.data is HyperNpc)
            {
                HyperNpc npc = (HyperNpc)btn.data;
                npc.Click();
            }
            else if (btn.data is HyperAttack)
            {
                HyperAttack attack = (HyperAttack)btn.data;
                attack.Click();
            }
        }
    }
Ejemplo n.º 4
0
    void UpdateMonster()
    {
        if (ShowMonster)
        {
            foreach (MAP_POS_DEFINE item in WorldManager.Instance.AnimylistObj)
            {
                bool     alreadyExist;
                UIButton newWin = AddNewWin(item, enemyIconName, out alreadyExist);
                if (newWin == null || alreadyExist)
                {
                    continue;
                }

                HyperAttack hyper = new HyperAttack();
                hyper.Name      = item.name;
                hyper.TargetId  = item.nServerID;
                hyper.SceneId   = WorldManager.Instance.GetActiveSceneID();
                hyper.PosTarget = new Vector3(item.pos.x, 0, item.pos.y);

                newWin.data = hyper;
            }
        }
    }