Esempio n. 1
0
 override public bool IsVisible()
 {
     return(UtilApi.IsActive(m_model.selfGo));
 }
Esempio n. 2
0
 override public void show()
 {
     UtilApi.SetActive(m_model.selfGo, true);
 }
Esempio n. 3
0
 override public void hide()
 {
     UtilApi.SetActive(m_model.selfGo, false);
 }
Esempio n. 4
0
 public void showLayout()
 {
     UtilApi.SetActive(pntGo, true);
 }
Esempio n. 5
0
 virtual protected void addHandle()
 {
     UtilApi.addEventHandle(gameObject(), onEntityClick);
 }
Esempio n. 6
0
 // 直接移动到目标点
 public void moveToDestDirect(Vector3 pos)
 {
     UtilApi.setPos(m_being.transform(), pos);
 }
Esempio n. 7
0
 public AuxResComponent()
 {
     m_selfLocalGo      = UtilApi.createGameObject("ResLocalGO");
     m_selfLocalGo.name = "m_selfLocalGo";
 }
Esempio n. 8
0
 public static int Range(int min, int max)
 {
     UnityEngine.Random.seed = (int)UtilApi.getUTCSec();
     return(UnityEngine.Random.Range(min, max));
 }
Esempio n. 9
0
 public override void unload()
 {
     UtilApi.UnloadAsset(m_texture);
     m_texture = null;
     base.unload();
 }
Esempio n. 10
0
 public static void adjustEffectRST(Transform transform)
 {
     UtilApi.setPos(transform, new Vector3(-0.01f, 0, 0.46f));
     UtilApi.setRot(transform, new Vector3(90, 0, 0));
     UtilApi.setScale(transform, new Vector3(0.5f, 0.48f, 1.0f));
 }
Esempio n. 11
0
 public static void copyTransform(Transform src, Transform dest)
 {
     UtilApi.setPos(dest, src.localPosition);
     UtilApi.setRot(dest, src.localRotation);
     UtilApi.setScale(dest, src.localScale);
 }
Esempio n. 12
0
 public static void normalPos(Transform tran)
 {
     UtilApi.setPos(tran, Vector3.zero);
 }
Esempio n. 13
0
 public static void normalPosScale(Transform tran)
 {
     //tran.localPosition = Vector3.zero;
     UtilApi.setPos(tran, new Vector3(0, 0, 0));
     UtilApi.setScale(tran, Vector3.one);
 }
Esempio n. 14
0
 public static void normalRST(Transform tran)
 {
     UtilApi.setPos(tran, new Vector3(0, 0, 0));
     UtilApi.setRot(tran, new Vector3(0, 0, 0));
     UtilApi.setScale(tran, Vector3.one);
 }
Esempio n. 15
0
 public void showLightWin()
 {
     UtilApi.SetActive(m_darkWin, false);
     UtilApi.SetActive(m_lightWin, true);
 }
Esempio n. 16
0
 public void onBigStartTimerEndHandle(TimerItemBase timer)
 {
     UtilApi.SetActive(m_bigStartPnl, true);
 }
Esempio n. 17
0
        override public void init()
        {
            for (int pathIdx = 0; pathIdx < (int)ePathIndex.eTotal; ++pathIdx)
            {
                if ((int)ePathIndex.eABC == pathIdx)
                {
                    buildPathSecond(pathIdx);
                }
                else if ((int)ePathIndex.eACB == pathIdx)
                {
                    if ((int)eRoomIndex.eB == m_fixIdx)
                    {
                        buildPathSecond(pathIdx);
                    }
                    else if ((int)eRoomIndex.eStart != m_fixIdx)
                    {
                        buildPathSecond(pathIdx);
                    }
                }
                else if ((int)ePathIndex.eBAC == pathIdx)
                {
                    if ((int)eRoomIndex.eB == m_fixIdx)
                    {
                        buildPathSecond(pathIdx);
                    }
                }
                else if ((int)ePathIndex.eBCA == pathIdx)
                {
                    if ((int)eRoomIndex.eB == m_fixIdx)
                    {
                        buildPathSecond(pathIdx);
                    }
                }
                else if ((int)ePathIndex.eCAB == pathIdx)
                {
                    if ((int)eRoomIndex.eB == m_fixIdx)
                    {
                        buildPathSecond(pathIdx);
                    }
                    else if ((int)eRoomIndex.eStart != m_fixIdx)
                    {
                        buildPathSecond(pathIdx);
                    }
                }
                else if ((int)ePathIndex.eCBA == pathIdx)
                {
                    if ((int)eRoomIndex.eB == m_fixIdx)
                    {
                        buildPathSecond(pathIdx);
                    }
                    else if ((int)eRoomIndex.eStart != m_fixIdx)
                    {
                        buildPathSecond(pathIdx);
                    }
                }
            }

            // 第二个房间有一个花头
            if (1 == m_iTag)
            {
                m_flowerHeadGo     = UtilApi.GoFindChildByPObjAndName("RootGo/Plane_1/FlowerHeadGo");
                m_flowerHeadEffect = Ctx.m_instance.m_sceneEffectMgr.addSceneEffect(33, m_flowerHeadGo, false, true, true);
                m_flowerHeadEffect.setLoopType(eSpriteLoopType.ePingPang);
            }
            // 第三个房间有一个花树
            if (2 == m_iTag)
            {
                m_flowerTreeGo     = UtilApi.GoFindChildByPObjAndName("RootGo/Plane_2/FlowerTree");
                m_flowerTreeEffect = Ctx.m_instance.m_sceneEffectMgr.addSceneEffect(34, m_flowerTreeGo, false, true, true);
            }
            // 如果是第五个房间,会有一个窗户
            if (4 == m_iTag)
            {
                m_darkWin  = UtilApi.GoFindChildByPObjAndName("RootGo/Plane_4/WinGo/DarkWinGo");
                m_lightWin = UtilApi.GoFindChildByPObjAndName("RootGo/Plane_4/WinGo/LightWinGo");
            }
        }
Esempio n. 18
0
 public void onSmallStar2fTimerEndHandle(TimerItemBase timer)
 {
     UtilApi.SetActive(m_smallStarPnl_2, true);
 }
Esempio n. 19
0
        // 线程下载
        public void runTask()
        {
            Ctx.m_instance.m_logSys.log(string.Format("线程开始下载下载任务 {0}", m_path));

            string saveFile    = Path.Combine(Ctx.m_instance.m_localFileSys.getLocalWriteDir(), UtilLogic.getRelPath(m_path));
            string origFile    = saveFile;  // 没有版本号的文件名字,如果本地没有这个文件,需要先建立这个文件,等下载完成后,然后再改名字,保证下载的文件除了网络传输因素外,肯定正确
            bool   bNeedReName = false;

            if (!string.IsNullOrEmpty(m_version))
            {
                saveFile = UtilLogic.combineVerPath(saveFile, m_version);
            }

            try
            {
                //打开网络连接
                string webPath;
                if (!string.IsNullOrEmpty(m_version))
                {
                    webPath = string.Format("{0}?v={1}", m_path, m_version);
                }
                else
                {
                    webPath = m_path;
                }

                HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(webPath);
                request.Method      = "GET";
                request.ContentType = "application/x-www-form-urlencoded";
                request.KeepAlive   = false;
                request.Proxy       = null;
                request.Timeout     = 5000;

                ServicePointManager.DefaultConnectionLimit = 50;

                // GetRequestStream 总是出错,因此只能使用 GET 方式
                //StreamWriter requestWriter = null;
                //Stream webStream = request.GetRequestStream();
                //requestWriter = new StreamWriter(webStream);
                //try
                //{
                //    string postString = string.Format("v={0}", m_version);
                //    requestWriter.Write(postString);
                //}
                //catch (Exception ex2)
                //{
                //    Ctx.m_instance.m_logSys.asynclog("error");
                //}
                HttpWebResponse response      = (HttpWebResponse)request.GetResponse();
                long            contentLength = response.ContentLength;
                long            readedLength  = 0;

                long       lStartPos  = 0;
                FileStream fileStream = null;
                if (File.Exists(saveFile))
                {
                    fileStream = File.OpenWrite(saveFile);
                    lStartPos  = fileStream.Length;
                    if (contentLength - lStartPos <= 0)     // 文件已经完成
                    {
                        fileStream.Close();
                        onRunTaskEnd();
                        Ctx.m_instance.m_logSys.log("之前文件已经下载完成,不用重新下载");
                        return;
                    }
                    fileStream.Seek(lStartPos, SeekOrigin.Current); //移动文件流中的当前指针
                }
                else
                {
                    bNeedReName = true;
                    try
                    {
                        fileStream = new FileStream(origFile, System.IO.FileMode.Create);
                    }
                    catch (Exception /*ex2*/)
                    {
                        Ctx.m_instance.m_logSys.error(string.Format("{0} 文件创建失败", saveFile));
                    }
                }

                if (lStartPos > 0)
                {
                    request.AddRange((int)lStartPos); //设置Range值
                    contentLength -= lStartPos;
                }

                //向服务器请求,获得服务器回应数据流
                System.IO.Stream retStream = response.GetResponseStream();
                int len = 1024 * 8;
                m_bytes = new byte[len];
                int    nReadSize = 0;
                string logStr;
                bool   isBytesValid = true;      // m_bytes 中数据是否有效
                while (readedLength != contentLength)
                {
                    nReadSize = retStream.Read(m_bytes, 0, len);
                    fileStream.Write(m_bytes, 0, nReadSize);
                    readedLength += nReadSize;
                    //logStr = "已下载:" + fs.Length / 1024 + "kb /" + contentLength / 1024 + "kb";
                    logStr = string.Format("文件 {0} 已下载: {1} b / {2} b", m_path, fileStream.Length, contentLength);
                    Ctx.m_instance.m_logSys.log(logStr);

                    if (isBytesValid)
                    {
                        if (readedLength != contentLength)
                        {
                            isBytesValid = false;
                        }
                    }
                }

                // 释放资源
                request.Abort();
                request = null;
                response.Close();
                response = null;

                retStream.Close();
                fileStream.Close();

                // 修改文件名字
                if (bNeedReName)
                {
                    UtilApi.renameFile(origFile, saveFile);
                }

                if (!isBytesValid)
                {
                    m_bytes = null;
                }

                if (readedLength == contentLength)
                {
                    m_isRunSuccess = true;
                }
                else
                {
                    m_isRunSuccess = false;
                }
                onRunTaskEnd();
            }
            catch (Exception /*err*/)
            {
                m_isRunSuccess = false;
                onRunTaskEnd();
            }
        }
Esempio n. 20
0
        protected Scrollbar m_scrollbar;       // 滚动条

        public AuxScrollbar(GameObject pntNode, string path, BtnStyleID styleId = BtnStyleID.eBSID_None)
        {
            m_selfGo    = UtilApi.TransFindChildByPObjAndPath(pntNode, path);
            m_scrollbar = UtilApi.getComByP <Scrollbar>(pntNode, path);
        }
Esempio n. 21
0
        public void setGoImage(GameObject go_)
        {
            Image _image = UtilApi.getComByP <Image>(go_);

            _image.sprite = m_image;
        }
Esempio n. 22
0
 public void hideLayout()
 {
     UtilApi.SetActive(pntGo, false);
 }