示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (TrAltar == null)
        {
            DestroyImmediate(this.transform.parent.gameObject);
        }
        else if (mStartEffect)
        {
            mEffectTime += Time.deltaTime;
            if (mEffectTime >= 1.5f)
            {
                RemoveAltar();
            }
            else if (mEffectTime >= 0.5f && !mSetupEffect)
            {
                ResourceUnit objUnit = ResourcesManager.Instance.loadImmediate(Curtpath, ResourceType.PREFAB);
                GameObject   obj     = GameObject.Instantiate(objUnit.Asset) as GameObject;

                AltarHeadPhoto[cuttSolt].gameObject.SetActive(false);
                obj.gameObject.transform.parent = AltarHeadPhoto[0].transform;
                obj.transform.localScale        = Vector3.one;
                obj.transform.localPosition     = Vector3.one;
                mSetupEffect = true;
            }
        }
    }
示例#2
0
    /// <summary>
    /// 动态创建可滑动的预设
    /// </summary>
    /// <param name="count"></param>
    /// <param name="head"></param>
    /// <param name="path"></param>
    protected void AutoCreateItems(int count, Transform head, string path)
    {
        for (int i = ButtonUis.Count - 1; i >= 0; i--)
        {
            GameObject.DestroyImmediate(ButtonUis.ElementAt(i).gameObject);
        }

        ButtonUis.Clear();
        int index = count / 6;

        if (count % 6 != 0)
        {
            index += 1;
        }
        for (int i = 0; i < index * 6; i++)
        {
            ResourceUnit objUnit = ResourcesManager.Instance.loadImmediate(path, ResourceType.PREFAB);
            GameObject   obj     = GameObject.Instantiate(objUnit.Asset) as GameObject;
            obj.name                 = obj.name + (i + 1).ToString();
            obj.transform.parent     = head;
            obj.transform.localScale = Vector3.one;
            //obj.transform.localPosition = Vector3.zero;
            DbClickBotton click = obj.GetComponent <DbClickBotton>();
            click.AddListener(i, OnButtonClickFunc);
            click.AddListenerDb(i, OnButtolDbClickFunc);
            ButtonUis.Add(click);
            //click.transform.GetComponent<UIGrid>().Reposition() ;
        }
        UIGrid grid = head.GetComponentInChildren <UIGrid>();

        grid.enabled       = true;
        grid.repositionNow = true;
        grid.Reposition();
    }
示例#3
0
        public void Enter()
        {
            SetStateTo(GameStateType.GS_Continue);

            mTime = 0;

            mNeedUpdate = true;
            mNeedScore  = true;

            //AudioClip clip = Resources.Load(AudioDefine.PATH_UIBGSOUND) as AudioClip;
            //AudioManager.Instance.PlayBgAudio(clip);

            ResourceUnit clipUnit = ResourcesManager.Instance.loadImmediate(AudioDefine.GetMapBgAudio((MAPTYPE)GameUserModel.Instance.GameMapID), ResourceType.ASSET);
            AudioClip    clip     = clipUnit.Asset as AudioClip;

            AudioManager.Instance.PlayBgAudio(clip);

            AdvancedGuideCtrl.Instance.Exit();


            EventCenter.AddListener <CEvent>(EGameEvent.eGameEvent_Loading, OnEvent);
            EventCenter.AddListener <CEvent>(EGameEvent.eGameEvent_IntoRoom, OnEvent);
            EventCenter.AddListener <CEvent>(EGameEvent.eGameEvent_IntoLobby, OnEvent);
            EventCenter.AddListener(EGameEvent.eGameEvent_ConnectServerFail, OnConnectServerFail);
        }
 public void TagMaterialsForTransport(ResourceUnit resource)
 {
     if (!this.m_ResourcesToTransport.Contains(resource))
     {
         this.m_ResourcesToTransport.Add(resource);
     }
 }
        public void LoadBase()
        {
            //BaseA = GameObject.Instantiate(Resources.Load(GameConstDefine.LoadGameBuildingEffectPath + "jidideath_A")) as GameObject;
            //BaseB = GameObject.Instantiate(Resources.Load(GameConstDefine.LoadGameBuildingEffectPath + "jidideath_B")) as GameObject;

            ResourceUnit BaseAUnit = ResourcesManager.Instance.loadImmediate(GameConstDefine.LoadGameBuildingEffectPath + "jidideath_A", ResourceType.PREFAB);

            BaseA = GameObject.Instantiate(BaseAUnit.Asset) as GameObject;

            ResourceUnit BaseBUnit = ResourcesManager.Instance.loadImmediate(GameConstDefine.LoadGameBuildingEffectPath + "jidideath_B", ResourceType.PREFAB);

            BaseB = GameObject.Instantiate(BaseBUnit.Asset) as GameObject;


            if (BaseA == null)
            {
                Debug.LogError("error  BaseA is null");
                return;
            }
            if (BaseB == null)
            {
                Debug.LogError("error  BaseB is null");
                return;
            }
            BaseB.gameObject.SetActive(false);
            BaseA.gameObject.SetActive(false);
            //Debug.LogError("DDDDDDDDD");
        }
示例#6
0
        void CreateSdk(string path)
        {
            ResourceUnit unit      = ResourceManager.Instance.LoadImmediate(path, EResourceType.PREFAB);
            GameObject   connector = GameObject.Instantiate(unit.Asset) as GameObject;

            connector.name = "SdkConnect";
        }
示例#7
0
        private void ShowTip()
        {
            if (times >= obsTask.ObsCount)
            {
                return;
            }
            if (objTip != null && objTip.activeInHierarchy)
            {
                return;
            }
            if (objTip == null)
            {
                //objTip = GameObject.Instantiate(Resources.Load(obsTask.ObsPath)) as GameObject;
                ResourceUnit objTipUnit = ResourcesManager.Instance.loadImmediate(obsTask.ObsPath, ResourceType.PREFAB);
                objTip = GameObject.Instantiate(objTipUnit.Asset) as GameObject;

                objTip.transform.parent        = UINewsGuide.Instance.transform;
                objTip.transform.localPosition = Vector3.zero;
                objTip.transform.localScale    = new Vector3(0.9f, 0.9f, 0.9f);
            }
            timeShow = DateTime.Now;
            times   += 1;
            objTip.SetActive(true);
            UILabel label = objTip.GetComponentInChildren <UILabel>();

            label.text = obsTask.ObsTip;
        }
示例#8
0
    public static AbsorbEffect createAbsorbEffect(Iplayer owner, GameObject start, GameObject end)
    {
        ResourceUnit objUnit = ResourcesManager.Instance.loadImmediate("effect/other/soul_absorb", ResourceType.PREFAB);
        GameObject   obj     = objUnit.Asset as GameObject;

        if (obj == null)
        {
            //Debug.LogError("Res Not Found:" + "effect/other/soul_absorb");
            return(null);
        }
        GameObject   rootNode = GameObject.Instantiate(obj) as GameObject;
        AbsorbEffect effect   = rootNode.GetComponent <AbsorbEffect>();

        if (effect != null)
        {
            effect.objStart = start;
            effect.objEnd   = end;
            if (start != null)
            {
                effect.transform.position = start.transform.position;
            }
            effect.timeCounter = totalTime;
            effect.effectOwner = owner;
        }
        owner.AbsorbProgressEffect = rootNode;
        //
        return(effect);
    }
 void OnShowBuildingTips(bool show)
 {
     if (show)
     {
         bTips.Clear();
         Dictionary <int, Ientity> dic = GuideBuildingTips.Instance.GetTipTargetDic();
         for (int i = 0; i < dic.Count; i++)
         {
             int          index   = GetEntityIndexByNpcId(dic.ElementAt(i).Value.NpcGUIDType);
             ResourceUnit objUnit = ResourcesManager.Instance.loadImmediate(GuideBuildingTips.Instance.pathArray[index], ResourceType.PREFAB);
             GameObject   obj     = GameObject.Instantiate(objUnit.Asset) as GameObject;
             obj.transform.parent     = XueTiaoManager.Instance.transform;
             obj.transform.localScale = Vector3.one;
             bTips.Add(dic.ElementAt(i).Value, obj);
         }
     }
     else
     {
         for (int i = 0; i < bTips.Count; i++)
         {
             GameObject.DestroyImmediate(bTips.ElementAt(i).Value);
         }
         bTips.Clear();
     }
     showBuildingTips = show;
 }
示例#10
0
    //[MenuItem( "Window/Resource Redundance Tools" )]
    //static void Init ( )
    //{
    //    ResourceRedundanceTools window = ( ResourceRedundanceTools ) EditorWindow.GetWindow( typeof( ResourceRedundanceTools ) );
    //    window.minSize = new Vector2( 400, 300 );

    //}

    bool DrawRow(Entry ent, bool operate)
    {
        GUI.color = (operate && null != mSelectResource && mSelectResource == ent.resUnit) ? new Color(0f, 0.5f, 1f) : Color.white;

        if (ent.resUnit != null)
        {
            GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f));
        }
        else
        {
            GUILayout.BeginHorizontal();
        }

        if (operate && EditorGUILayout.Toggle(ent.bCheck, GUILayout.Width(20.0f)))
        {
            ent.bCheck = true;
        }
        else
        {
            ent.bCheck = false;
        }

        if (GUILayout.Button(ent.resUnit.GetFileName(), EditorStyles.label, GUILayout.Width(400f)) && operate)
        {
            mSelectResource = ent.resUnit;
        }

        GUILayout.Label(ent.resUnit.GetPathName(), GUILayout.Width(600f));
        GUILayout.Label(ent.stateName, GUILayout.Width(100f));

        GUILayout.EndHorizontal();

        return(true);
    }
示例#11
0
        public void ShowFriendOnLine()
        {
            foreach (var item in FriendManager.Instance.RoomInvite)
            {
                OnLineFriend olf = null;
                if (!OnLineNickName.TryGetValue(item.Key, out olf))
                {
                    ResourceUnit objUnit = ResourcesManager.Instance.loadImmediate(GameConstDefine.LoadInvitationUI, ResourceType.PREFAB);
                    GameObject   obj     = GameObject.Instantiate(objUnit.Asset) as GameObject;
                    obj.transform.parent        = mOnLineGrid.transform;
                    obj.transform.localPosition = Vector3.zero;
                    obj.transform.localScale    = Vector3.one;

                    olf = new OnLineFriend();
                    olf.mHeroHeadIcon = obj.transform.FindChild("Portrait/Head").GetComponent <UISprite>();
                    olf.mHeadName     = obj.transform.FindChild("Name/Label").GetComponent <UILabel>();
                    olf.mSelect       = obj.GetComponent <UIToggle>();
                    OnLineNickName.Add(item.Key, olf);
                    EventDelegate.Add(olf.mSelect.onChange, OnSelectName);
                }
                olf.SGUID                    = item.Key;
                olf.mHeadName.text           = olf.nickName = item.Value.nickName;
                olf.mHeroHeadIcon.spriteName = item.Value.ToString();
                OnLineNickName[item.Key]     = olf;
            }
        }
示例#12
0
    /// <summary>
    /// 实例化资源
    /// </summary>
    /// <param name="parent"></param>
    /// <param name="path"></param>
    /// <returns></returns>
    public static GameObject LoadRes(Transform parent, string path)
    {
        if (CheckResInDic(path))
        {
            GameObject asset = null;
            m_LoadResDic.TryGetValue(path, out asset);
            if (asset != null)
            {
                return(asset);
            }
            else
            {
                m_LoadResDic.Remove(path);
            }
        }
        GameObject   obj     = null;
        ResourceUnit objUnit = ResourceManager.Instance.LoadImmediate(path, ResourceType.PREFAB);

        if (objUnit == null || objUnit.Asset == null)
        {
            Debug.LogError("加载资源失败:" + path);
            return(null);
        }
        obj = GameObject.Instantiate(objUnit.Asset) as GameObject;
        obj.transform.SetParent(parent);
        obj.transform.localScale    = Vector3.one;
        obj.transform.localPosition = Vector3.zero;
        m_LoadResDic.Add(path, obj);
        return(obj);
    }
        public void Enter()
        {
            SetStateTo(GameStateType.GS_Continue);

            //yaz修改
            //mScenesRoot = GameObject.Instantiate(Resources.Load(GameConstDefine.GameLogin)) as GameObject;
            //mUIRoot = LoadUiResource.LoadRes(GameMethod.GetUiCamera.transform, GameConstDefine.LoadGameLoginUI);
            //AudioClip clip = Resources.Load(AudioDefine.PATH_UIBGSOUND) as AudioClip;

            ResourceUnit sceneRootUnit = ResourcesManager.Instance.loadImmediate(GameConstDefine.GameLogin, ResourceType.PREFAB);

            mScenesRoot = GameObject.Instantiate(sceneRootUnit.Asset) as GameObject;

            //mUIRoot = LoadUiResource.LoadRes(GameMethod.GetUiCamera.transform, GameConstDefine.LoadGameLoginUI);

            LoginCtrl.Instance.Enter();

            ResourceUnit audioClipUnit = ResourcesManager.Instance.loadImmediate(AudioDefine.PATH_UIBGSOUND, ResourceType.ASSET);
            AudioClip    clip          = audioClipUnit.Asset as AudioClip;


            AudioManager.Instance.PlayBgAudio(clip);

            EventCenter.AddListener <CEvent>(EGameEvent.eGameEvent_InputUserData, OnEvent);
            EventCenter.AddListener <CEvent>(EGameEvent.eGameEvent_IntoLobby, OnEvent);
            EventCenter.AddListener(EGameEvent.eGameEvent_SdkLogOff, SdkLogOff);
        }
示例#14
0
    public void SetShowEffect(Transform tran, string name)
    {
        if (tran.childCount != 0)
        {
            for (int i = 0; i < tran.childCount; i++)
            {
                DestroyImmediate(tran.GetChild(i).gameObject);
            }
        }
        //GameObject obj = Resources.Load("effect/ui_effect/" + name) as GameObject;
        ResourceUnit objUnit = ResourcesManager.Instance.loadImmediate("effect/ui_effect/" + name, ResourceType.PREFAB);
        GameObject   obj     = objUnit.Asset as GameObject;

        if (obj == null)
        {
            //Debug.LogError("Res Not Found:" + "effect/ui_effect/soul_01");
        }

        ShowEffect = GameObject.Instantiate(obj) as GameObject;
        ShowEffect.transform.parent        = tran;
        ShowEffect.transform.localPosition = Vector3.zero;
        ShowEffect.transform.localScale    = Vector3.one;
        ShowEffect = null;
        DestroyImmediate(ShowEffect);
    }
示例#15
0
        /// <summary>
        /// 销毁特效
        /// </summary>
        /// <param name="desEffect"></param>
        /// <param name="TranObj"></param>
        /// <param name="tran"></param>
        /// <param name="path"></param>
        /// <param name="delPath"></param>
        void DestroyEffect(ref GameObject desEffect, GameObject TranObj, string delPath)
        {
            if (TranObj != null)
            {
                if (desEffect != null)
                {
                    desEffect.transform.parent = null;
                    GameObject.DestroyImmediate(desEffect);
                }
                Iplayer player = PlayerManager.Instance.LocalPlayer;
                if (player == null)
                {
                    return;
                }
                //GameObject obj = Resources.Load(delPath) as GameObject;
                ResourceUnit objUnit = ResourcesManager.Instance.loadImmediate(delPath, ResourceType.PREFAB);
                GameObject   obj     = objUnit.Asset as GameObject;

                if (obj == null)
                {
                    Debug.LogError("Res Not Found:" + delPath);
                }
                desEffect = GameObject.Instantiate(obj) as GameObject;
                desEffect.transform.position = TranObj.transform.position;
                TranObj.transform.parent     = null;
                GameObject.DestroyImmediate(TranObj);
            }
        }
示例#16
0
    public void ProcessResource(int type, string name, ResourceUnit parentRes)
    {
        if (mTypeFileDictionary.ContainsKey(type))
        {
            Dictionary <string, ResourceUnit> fileDictionary = mTypeFileDictionary[type];

            if (fileDictionary.ContainsKey(name))
            {
                ResourceUnit res = fileDictionary[name];

                res.SetResourceAnalyzeType(type);
                res.AddReferrence(parentRes);
                parentRes.AddInclude(res);

                AnalyzeBase analyzer = GetAnalyzer(type);
                if (null != analyzer)
                {
                    if (!res.IsQueued())
                    {
                        res.SetQueued();
                        mResUnitQueue.Enqueue(res);
                    }
                }
            }
        }
    }
示例#17
0
    /// <summary>
    /// Инициализация объекта на основе того, какой тип и идентификатор хранилища ресурсов передан.
    /// Для дополнительного контроля используется идентификатор игрока
    /// </summary>
    /// <param name="storageType"></param>
    /// <param name="storageId"></param>
    /// <param name="playerId"></param>
    public void LoadData(StorageType storageType, int storageId, int playerId)
    {
        resources = new List <ResourceUnit>();
        string q = $@"
            SELECT
                resource_type,
                blueprint_type,
                quantity
            FROM
                players_resources
            WHERE
                storage_type = {(int)storageType}
                AND storage_id = {storageId}
                AND player_id = {playerId}";

        SqlDataReader r = DataConnection.GetReader(q);

        if (r.HasRows)
        {
            while (r.Read())
            {
                ResourceUnit curRes = new ResourceUnit();
                curRes.ResourceTypeId = (int)r["resource_type"];
                curRes.BlueprintId    = (int)r["blueprint_type"];
                curRes.Quantity       = (int)r["quantity"];
                resources.Add(curRes);
            }
        }
        r.Close();
    }