Ejemplo n.º 1
0
    void mapShow()
    {
        mapShowStep = -1;
        AudioSource audio = sdGameLevel.instance.gameObject.GetComponent <AudioSource>();

        if (audio != null)
        {
            audio.Stop();
            audio.clip = AudioClipOld;
            audio.Play();
        }
        if (TownUI != null && TownUI.activeSelf == false)
        {
            TownUI.SetActive(true);

            sdTown town = TownUI.GetComponent <sdTown>();
            if (town != null)
            {
                town.CheckSystemLock();
            }
        }

        if (onFinish.Count > 0)
        {
            EventDelegate.Execute(onFinish);
            onFinish.Clear();
        }
    }
Ejemplo n.º 2
0
    public void AddChatInfo(byte channelType, string from, string to, string txt)
    {
        sdChatInfo info = new sdChatInfo();

        info.channelType = channelType;
        info.from        = from;
        info.txt         = txt;
        info.to          = to;
        if (chatList.Count >= 50)
        {
            chatList.Remove(chatList[0]);
        }
        chatList.Add(info);

        string str = "";

        switch (info.channelType)
        {
        case (byte)HeaderProto.EChatType.CHAT_TYPE_SYSTEM:
        {
            str = string.Format("{0}[{1}]:{2}{3}", color_System, sdConfDataMgr.Instance().GetShowStr("System"), color_System, info.txt);
            break;
        }

        case (byte)HeaderProto.EChatType.CHAT_TYPE_WORLD:
        {
            str = string.Format("{0}[{1}]{2}:{3}{4}", color_World, sdConfDataMgr.Instance().GetShowStr("World"), info.from, color_Word, info.txt);
            break;
        }

        case (byte)HeaderProto.EChatType.CHAT_TYPE_GUILD:
        {
            break;
        }

        case (byte)HeaderProto.EChatType.CHAT_TYPE_GROUP:
        {
            break;
        }

        case (byte)HeaderProto.EChatType.CHAT_TYPE_PRIVATE:
        {
            break;
        }
        }

        sdUICharacter.Instance.AddChatInfo(str);
        if (sdUICharacter.Instance.GetTownUI() != null)
        {
            sdTown town = sdUICharacter.Instance.GetTownUI().GetComponent <sdTown>();
            town.AddChat(str);
        }
    }
Ejemplo n.º 3
0
    public bool CanRun()
    {
        int a = (int)conType;

        switch (conType)
        {
        case GuideConditionType.None:
        {
            return(true);
        }

        case GuideConditionType.FB:
        {
            int levelId = int.Parse(conParam.ToString());
            if (levelId == sdUICharacter.Instance.iCurrentLevelID && sdGameLevel.instance != null && sdGameLevel.instance.mainChar != null && sdUICharacter.Instance.GetFightUi() != null)
            {
                return(true);
            }
            break;
        }

        case GuideConditionType.FBPass:
        {
            int levelId = int.Parse(conParam.ToString());
            if (levelId == sdUICharacter.Instance.iCurrentLevelID && sdUICharacter.Instance.GetJiesuanWnd() != null)
            {
                return(true);
            }
            break;
        }

        case GuideConditionType.GetItem:
        {
            if (sdGameItemMgr.Instance.hasItem(conParam.ToString()))
            {
                return(true);
            }
            break;
        }

        case GuideConditionType.GetPet:
        {
            if (sdNewPetMgr.Instance.hasPet(conParam.ToString()))
            {
                return(true);
            }
            break;
        }

        case GuideConditionType.Level:
        {
            if (sdGameLevel.instance != null && sdGameLevel.instance.mainChar != null &&
                sdGameLevel.instance.mainChar.Level >= int.Parse(conParam.ToString()))
            {
                return(true);
            }
            break;
        }

        case GuideConditionType.PetLevel:
        {
            break;
        }

        case GuideConditionType.Click:
        {
            if (isListen == false)
            {
                EventDelegate finish = new EventDelegate(OnCanRun);
                if (conParam.ToString() == "0")
                {
                    sdUICharacter.Instance.ShowMask(false, null);
                    sdUICharacter.Instance.AddMaskEvent(finish, false);
                }
                else
                {
                    string[] nameList = conParam.ToString().Split('|');
                    foreach (string name in nameList)
                    {
                        GameObject obj = GameObject.Find(name);
                        if (obj == null)
                        {
                            return(false);
                        }
                        if (obj.GetComponent <sdRoleWndButton>() == null)
                        {
                            obj.AddComponent <sdRoleWndButton>();
                        }
                        if (!obj.GetComponent <sdRoleWndButton>().onClick.Contains(finish))
                        {
                            obj.GetComponent <sdRoleWndButton>().onClick.Add(finish);
                        }
                    }
                }
                isListen = true;
            }

            return(canRun);
        }

        case GuideConditionType.UseItem:
        {
            break;
        }

        case GuideConditionType.EnterTrigger:
        {
            if (isListen == false)
            {
                string     name = conParam.ToString();
                GameObject obj  = GameObject.Find(name);
                if (obj != null)
                {
                    EventDelegate finish = new EventDelegate(OnCanRun);
                    obj.GetComponent <sdBaseTrigger>().onEnter.Add(finish);
                    isListen = true;
                }
            }
            return(canRun);
        }

        case GuideConditionType.LeaveTrigger:
        {
            if (isListen == false)
            {
                string     name = conParam.ToString();
                GameObject obj  = GameObject.Find(name);
                if (obj != null)
                {
                    EventDelegate finish = new EventDelegate(OnCanRun);
                    obj.GetComponent <sdBaseTrigger>().onLeave.Add(finish);
                }
                isListen = true;
            }
            return(canRun);
        }

        case GuideConditionType.InWorldMap:
        {
            if (sdGameLevel.instance != null && sdGameLevel.instance.levelType == sdGameLevel.LevelType.WorldMap)
            {
                return(true);
            }
            break;
        }

        case GuideConditionType.ExistObj:
        {
            string     name = conParam.ToString();
            GameObject obj  = GameObject.Find(name);
            if (obj != null)
            {
                return(true);
            }
            break;
        }

        case GuideConditionType.NoObj:
        {
            string     name = conParam.ToString();
            GameObject obj  = GameObject.Find(name);
            if (obj == null)
            {
                return(true);
            }
            break;
        }

        case GuideConditionType.BetterEquip:
        {
            if (sdUICharacter.Instance.GetRoleWnd() == null)
            {
                return(false);
            }
            if (sdGameLevel.instance == null || sdGameLevel.instance.mainChar == null)
            {
                return(false);
            }
            Hashtable needEquip = new Hashtable();
            Hashtable itemTable = sdGameItemMgr.Instance.GetAllItem((int)PanelType.Panel_Bag, -1);
            foreach (DictionaryEntry info in itemTable)
            {
                sdGameItem item = info.Value as sdGameItem;
                if (item.equipPos < 0)
                {
                    continue;
                }
                if (!item.CanEquip(sdGameLevel.instance.mainChar))
                {
                    continue;
                }
                if (needEquip.ContainsKey(item.equipPos))
                {
                    sdGameItem maxItem  = needEquip[item.equipPos] as sdGameItem;
                    int        maxScore = sdConfDataMgr.Instance().GetItemScore(maxItem.instanceID);
                    int        curScore = sdConfDataMgr.Instance().GetItemScore(item.instanceID);
                    if (curScore > maxScore)
                    {
                        needEquip[item.equipPos] = item;
                    }
                }
                else
                {
                    needEquip.Add(item.equipPos, item);
                }
            }

            foreach (DictionaryEntry info in needEquip)
            {
                sdGameItem item        = info.Value as sdGameItem;
                sdGameItem compareItem = sdGameItemMgr.Instance.getEquipItemByPos(item.equipPos);
                if (compareItem == null)
                {
                    return(true);
                }
                int score        = sdConfDataMgr.Instance().GetItemScore(item.instanceID);
                int compareScore = sdConfDataMgr.Instance().GetItemScore(compareItem.instanceID);
                if (score > compareScore)
                {
                    return(true);
                }
            }
            break;
        }

        case GuideConditionType.Unlock:
        {
            if (!isListen)
            {
                if (sdUICharacter.Instance.GetTownUI() == null)
                {
                    return(false);
                }
                sdTown town = sdUICharacter.Instance.GetTownUI().GetComponent <sdTown>();
                if (town.SystemUnlockWnd == null)
                {
                    return(false);
                }
                SystemUnlockBtn btn = town.SystemUnlockWnd.GetComponentInChildren <SystemUnlockBtn>();
                if (btn == null)
                {
                    return(false);
                }
                string name = conParam.ToString();
                if (btn.mSystem != name)
                {
                    return(false);
                }
                EventDelegate finish = new EventDelegate(OnCanRun);
                btn.onFinish.Add(finish);
                isListen = true;
            }
            return(canRun);
        }

        case GuideConditionType.LevelUnLock:
        {
            if (!isListen)
            {
                if (sdWorldMapPath.TownUI == null)
                {
                    return(false);
                }

                EventDelegate finish = new EventDelegate(OnCanRun);
                sdWorldMapPath.onFinish.Add(finish);
                isListen = true;
            }
            return(canRun);
        }
        }
        return(false);
    }