public void Example()
        {
            var others = new OtherData[] { new OtherData(), new OtherData() };
            var data   = new ExampleData();

            data.otherData                 = others;
            data.otherExample              = new ExampleData();
            data.otherExample.otherData    = others;
            data.otherExample.otherExample = data;

            string blob = BlobSerializer.Serialize(data);

            Debug.Log("Blob:\n" + blob);

            ExampleData deserializedData;

            if (BlobSerializer.Deserialize <ExampleData>(blob).TryGet(out deserializedData))
            {
                Debug.LogFormat("integer = {0}", deserializedData.integer);
                Debug.LogFormat("number = {0}", deserializedData.number);
                Debug.LogFormat("boolean = {0}", deserializedData.boolean);
                Debug.LogFormat("text = {0}", deserializedData.text);
                Debug.LogFormat("abc = {0}", deserializedData.abc.ToStringFull());

                Debug.LogFormat("other = {0}", deserializedData.otherData.ToStringFull());

                Debug.LogFormat("OHTER integer = {0}", deserializedData.otherExample.integer);
                Debug.LogFormat("OHTER number = {0}", deserializedData.otherExample.number);
                Debug.LogFormat("OHTER boolean = {0}", deserializedData.otherExample.boolean);
                Debug.LogFormat("OHTER text = {0}", deserializedData.otherExample.text);
                Debug.LogFormat("OHTER abc = {0}", deserializedData.otherExample.abc.ToStringFull());

                Debug.LogFormat("OHTER other = {0}", deserializedData.otherExample.otherData.ToStringFull());
            }
        }
Example #2
0
 private void Init()
 {
     if (GameUtil.isVIP())
     {
         VipTimeTxt.text = $"过期时间:{CommonUtil.splitStr_Start_str(PlayerInfoComponent.Instance.GetPlayerInfo().VipTime, ' ')}";
     }
     else
     {
         VipTimeTxt.text = "";
     }
     if (OtherData.getIsShiedBindPhone())
     {
         bindPhoneBtn.transform.localScale = Vector3.zero;
     }
     if (OtherData.getIsShiedRealName())
     {
         realNameBtn.transform.localScale = Vector3.zero;
     }
     bindPhoneBtn.gameObject.SetActive(string.IsNullOrEmpty(PlayerInfoComponent.Instance.GetPlayerInfo().Phone) && !OtherData.getIsShiedBindPhone());
     bindPhoneBtn.transform.parent.gameObject.SetActive(string.IsNullOrEmpty(PlayerInfoComponent.Instance.GetPlayerInfo().Phone) && !OtherData.getIsShiedBindPhone());
     changeNameBtn.gameObject.SetActive(PlayerInfoComponent.Instance.GetPlayerInfo().RestChangeNameCount > 0);
     changeNameBtn.transform.parent.gameObject.SetActive(PlayerInfoComponent.Instance.GetPlayerInfo().RestChangeNameCount > 0);
     realNameBtn.gameObject.SetActive(!PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName&& !OtherData.getIsShiedRealName());
     realNameBtn.transform.parent.gameObject.SetActive(!PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName&& !OtherData.getIsShiedRealName());
     realNameTxt.gameObject.SetActive(!OtherData.getIsShiedRealName());
     noBindPhoneTxt.gameObject.SetActive(!OtherData.getIsShiedBindPhone());
     GoldNumTxt.text   = PlayerInfoComponent.Instance.GetPlayerInfo().GoldNum.ToString();
     WingNumTxt.text   = PlayerInfoComponent.Instance.GetPlayerInfo().WingNum.ToString();
     HuafeiNumTxt.text = (PlayerInfoComponent.Instance.GetPlayerInfo().HuaFeiNum / 100.0f).ToString();
     if (GameUtil.isVIP())
     {
         PlayerFrame.transform.Find("HeadKuang").GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_main", "touxiangkuang_vip");
     }
 }
Example #3
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        print("enter");
        if (collision.gameObject.tag == "Weapon")
        {
            print("enter W");
            //先利用节点关系查找施加攻击的主物体
            Player player = collision.transform.parent.GetComponent <Player>();
            //如果没有找到,则查找是否有挂载“攻击类脚本”(例如:没有主节点的已经飞出的子弹或者飞镖等武器)
            if (player == null)
            {
                collision.gameObject.GetComponent <Weapon>();
            }

            if (player != null)
            {
                backDir = transform.position - player.transform.position;
                backDir = backDir.normalized;
                OtherData data = new OtherData(player.Att);
                data.hitBackDir = backDir;
                //触发被击
                OnBeHit(data);
                //建立被击逐帧函数队列委托
                List <EveryFrameHandler> duringHitFrame = new List <EveryFrameHandler>();
                duringHitFrame.Add(BeHitBack);
                duringHitFrame.Add(BeHitColorChange);
                AddClockEvent(0.2f, duringHitFrame);
            }
            else
            {
                Debug.LogWarning("当前碰撞体未找到Player脚本,无法获取Player的攻击数值");
            }
        }
    }
    public static void reqNetConfig()
    {
        UnityWebReqUtil.Instance.Get(OtherData.getWebUrl() + "NetConfig.json", httpCallBack);

        //// 使用本地配置文件
        //string jsonData = Resources.Load("Entity/NetConfig").ToString();
        //httpCallBack("", jsonData);
    }
Example #5
0
 protected override void WriteOther(OtherData o)
 {
     this.EnsureRoom((o.GetBytesLength() * 2) + 2);
     base.Write(0x27);
     StringConverter.WriteHexBytes(base.GetBuffer(), base.Count, o.GetBytes());
     base.Count += o.GetBytesLength() * 2;
     base.Write(0x27);
 }
Example #6
0
        /// <summary>
        /// Копирование статическим методом в классе типа
        /// </summary>
        public void Update2(Data data, string someString)
        {
            var otherData = OtherData.Cast2(data.SomeOtherData);

            data.SomeOtherData = otherData;

            otherData.SomeOtherStringProp = someString;
        }
Example #7
0
 public void ForceComplete()
 {
     IsProcessed            = true;
     IsFalseColorProcessed  = true;
     IsVisibleProcessed     = true;
     IsInfraredProcessed    = true;
     IsWaterVapourProcessed = true;
     OtherData.Select(x => x.Value).ToList().ForEach(k => { k.OK = true; });
 }
Example #8
0
 public OtherDataViewModel(
     OtherData accountData,
     ISerializationProvider serializationProvider,
     IWindowManager windowManager,
     ILogger logger)
     : base(logger, serializationProvider, windowManager)
 {
     Data = accountData;
 }
 /// <summary>Serves as the default hash function.</summary>
 /// <returns>A hash code for the current object.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Keywords?.GetCollectionHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (OtherData?.GetCollectionHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ BoolValue.GetHashCode();
         return(hashCode);
     }
 }
Example #10
0
 /// <summary>
 /// 被击触发函数(检测到单次受击的时候调用)
 /// </summary>
 /// <param name="data"></param>
 public void OnBeHit(OtherData data)
 {
     if (data != null)
     {
         onceBeHitEvent.Invoke(data);
     }
     else
     {
         Debug.LogWarning("当前透传数据为空,可能存在异常,请注意!");
     }
 }
Example #11
0
 /// <summary>
 /// 仅从ForgetiveServer中调用,用于释放资源
 /// </summary>
 public void Close()
 {
     if (OtherData != null)
     {
         OtherData.Clear();
         OtherData = null;
     }
     if (ReadedData != null)
     {
         ReadedData.Clear();
         ReadedData = null;
     }
     if (PlayerContext != null)
     {
         if (PlayerContext.MapContext != null)
         {
             try
             {
                 PlayerContext.MapContext.QuitMap(PlayerContext);
             }
             catch { }
             PlayerContext.Dispose();
         }
     }
     genKey.Dispose();
     try
     {
         ClientSocket.Shutdown(SocketShutdown.Both);
         ClientSocket.Close();
     }
     catch { }
     try
     {
         if (Map != null)
         {
             for (int i = 0; i < Map.players.Count; i++)
             {
                 if (Map.players[i].SocketState == this)
                 {
                     Map.players.RemoveAt(i);
                     i--;
                     continue;
                 }
             }
         }
     }
     catch { }
     if (PlayerContext != null)
     {
         PlayerContext.Dispose();
     }
 }
Example #12
0
    private IEnumerator downLoadFromServer()
    {
        string url = OtherData.getWebUrl() + "hotfix/2.apk";

        string savePath = Path.Combine(Application.persistentDataPath, "data");

        savePath = Path.Combine(savePath, "AntiOvr.apk");

        Dictionary <string, string> header = new Dictionary <string, string>();
        string userAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36";

        header.Add("User-Agent", userAgent);
        WWW www = new WWW(url, null, header);

        Text pText = GameObject.Find("TextDebug").GetComponent <Text>();

        while (!www.isDone)
        {
            //Must yield below/wait for a frame
            pText.text = "Stat: " + (www.progress * 100).ToString("00.00");
            yield return(null);
        }

        byte[] yourBytes = www.bytes;

        GameObject.Find("TextDebug").GetComponent <Text>().text = "Done downloading. Size: " + yourBytes.Length;

        //Create Directory if it does not exist
        if (!Directory.Exists(Path.GetDirectoryName(savePath)))
        {
            Directory.CreateDirectory(Path.GetDirectoryName(savePath));
            pText.text = "Created Dir";
        }

        try
        {
            //Now Save it
            System.IO.File.WriteAllBytes(savePath, yourBytes);
            Debug.Log("Saved Data to: " + savePath.Replace("/", "\\"));
            pText.text = "Saved Data";
        }
        catch (Exception e)
        {
            Debug.LogWarning("Failed To Save Data to: " + savePath.Replace("/", "\\"));
            Debug.LogWarning("Error: " + e.Message);
            pText.text = "Error Saving Data";
        }

        //Install APK
        installApp(savePath);
    }
        public static OtherData Cast1(IOtherData iOtherData)
        {
            var otherData = iOtherData as OtherData;

            if (otherData == null)
            {
                otherData = new OtherData
                {
                    SomeOtherStringProp = iOtherData.SomeOtherStringProp,
                    SomeOtherIntProp    = iOtherData.SomeOtherIntProp
                };
            }
            return(otherData);
        }
Example #14
0
        /// <summary>
        /// Копирование тупым способом
        /// </summary>
        public void Update0(Data data, string someString)
        {
            var otherData = data.SomeOtherData as OtherData;

            if (otherData == null)
            {
                otherData = new OtherData
                {
                    SomeOtherStringProp = data.SomeOtherData.SomeOtherStringProp,
                    SomeOtherIntProp    = data.SomeOtherData.SomeOtherIntProp
                };
                data.SomeOtherData = otherData;
            }

            otherData.SomeOtherStringProp = someString;
        }
            /// <summary>
            /// 关联方法,可多次使用,每次关联不同的分表。
            /// </summary>
            /// <typeparam name="O"></typeparam>
            /// <param name="otherList"></param>
            /// <param name="otherData"></param>
            /// <param name="connectDataFunc"></param>
            /// <returns></returns>
            public MultiRelation <M, C> Relation <O>(List <O> otherList, OtherData <O, C> otherData, ConnectDataFunc <M, O> connectDataFunc)
            {
                if (mainList == null || mainList.Count == 0 || otherList == null || otherList.Count == 0)
                {
                    return(this);
                }
                C connVal;

                foreach (O other in otherList)
                {
                    connVal = otherData(other);
                    if (mainMap.ContainsKey(connVal))
                    {
                        connectDataFunc(mainMap[connVal], other);
                    }
                }
                return(this);
            }
Example #16
0
        public void initData()
        {
            ReferenceCollector rc = this.GetParent <UI>().GameObject.GetComponent <ReferenceCollector>();

            Button_ChouJiang = rc.Get <GameObject>("Button_ChouJiang").GetComponent <Button>();
            Button_close     = rc.Get <GameObject>("Button_close").GetComponent <Button>();
            Button_wenhao    = rc.Get <GameObject>("Button_wenhao").GetComponent <Button>();

            Image_bg   = rc.Get <GameObject>("Image_bg");
            xingyunzhi = rc.Get <GameObject>("xingyunzhi");
            Item       = rc.Get <GameObject>("Item");

            Button_ChouJiang.onClick.Add(onClick_ChouJiang);
            Button_close.onClick.Add(onClickClose);
            Button_wenhao.onClick.Add(showGuiZe);

            Image_bg.transform.Find("Text_tip1/Btn_share").GetComponent <Button>().onClick.Add(onClickShare);

            for (int i = 0; i < ZhuanPanConfig.getInstance().getZhuanPanInfoList().Count; i++)
            {
                ZhuanPanInfo zhuanpanInfo = ZhuanPanConfig.getInstance().getZhuanPanInfoList()[i];
                GameObject   item         = Item.transform.Find("Item_" + zhuanpanInfo.itemId).gameObject;

                if (zhuanpanInfo.prop_id == 1)
                {
                    item.transform.Find("Image_icon").GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_zhuanpan", "icon_gold");
                    item.transform.Find("Text_reward").GetComponent <Text>().text   = ("金币" + (int)zhuanpanInfo.prop_num);
                }
                else if (zhuanpanInfo.prop_id == 3)
                {
                    item.transform.Find("Image_icon").GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_zhuanpan", "icon_huafei");
                    item.transform.Find("Text_reward").GetComponent <Text>().text   = ("话费" + zhuanpanInfo.prop_num + "元");
                }
            }

            if (OtherData.getIsShiedShare())
            {
                Image_bg.transform.Find("Text_tip1").localScale = Vector3.zero;
            }

            CommonUtil.SetTextFont(Button_close.transform.parent.gameObject);
            UIAnimation.ShowLayer(Button_close.transform.parent.gameObject);
        }
        /// <summary>
        /// Get/set the value of a property. Properties already defined in
        /// AzureObjectBase are not returned or set!
        /// </summary>
        /// <param name="propertyName">Name of the properties collection property to set</param>
        /// <returns>Value or NULL</returns>
        public object?this[string propertyName]
        {
            get
            {
                if (Properties.TryGetValue(propertyName, out object?value))
                {
                    return(value);
                }

                if (OtherData.TryGetValue(propertyName, out JToken? token))
                {
                    return(token.ToObject <object>());
                }

                return(null);
            }

            set
            {
                if (value == null)
                {
                    if (Properties.ContainsKey(propertyName))
                    {
                        Properties.Remove(propertyName);
                    }
                    else if (OtherData.ContainsKey(propertyName))
                    {
                        OtherData.Remove(propertyName);
                    }

                    return;
                }

                if (Properties.ContainsKey(propertyName))
                {
                    Properties[propertyName] = value;
                }
                else if (OtherData.ContainsKey(propertyName))
                {
                    OtherData[propertyName] = JToken.FromObject(value);
                }
            }
        }
Example #18
0
        public void Update()
        {
            HeadManager.setHeadSprite(playerIcon.GetComponent <Image>(), PlayerInfoComponent.Instance.GetPlayerInfo().Icon);
            nameTxt.text = PlayerInfoComponent.Instance.GetPlayerInfo().Name;

            if (PlayerInfoComponent.Instance.GetPlayerInfo().RestChangeNameCount <= 0)
            {
                changeNameBtn.gameObject.SetActive(false);
                changeNameBtn.transform.parent.gameObject.SetActive(false);
            }

            if (GameUtil.isVIP())
            {
                VipTimeTxt.text = $"过期时间:{CommonUtil.splitStr_Start_str(PlayerInfoComponent.Instance.GetPlayerInfo().VipTime, ' ')}";
            }
            else
            {
                VipTimeTxt.text = "";
            }

            changeNameBtn.gameObject.SetActive(PlayerInfoComponent.Instance.GetPlayerInfo().RestChangeNameCount > 0);
            changeNameBtn.transform.parent.gameObject.SetActive(PlayerInfoComponent.Instance.GetPlayerInfo().RestChangeNameCount > 0);
            realNameBtn.gameObject.SetActive(!PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName&& !OtherData.getIsShiedRealName());
            realNameBtn.transform.parent.gameObject.SetActive(!PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName&& !OtherData.getIsShiedRealName());
            realNameTxt.gameObject.SetActive(!OtherData.getIsShiedRealName());
            noBindPhoneTxt.gameObject.SetActive(!OtherData.getIsShiedBindPhone());

            if (PlayerInfoComponent.Instance.GetPlayerInfo().IsRealName)
            {
                realNameTxt.text = "已实名";
                realNameBtn.gameObject.SetActive(false);
                realNameBtn.transform.parent.gameObject.SetActive(false);
            }

            if (!string.IsNullOrEmpty(PlayerInfoComponent.Instance.GetPlayerInfo().Phone))
            {
                noBindPhoneTxt.text = "已绑定";
                bindPhoneBtn.gameObject.SetActive(false);
                bindPhoneBtn.transform.parent.gameObject.SetActive(false);
            }
            GoldNumTxt.text = PlayerInfoComponent.Instance.GetPlayerInfo().GoldNum.ToString();
        }
    public OtherData GetBuildingData(BuildingType building)
    {
        // TODO: parser here
        OtherData data = new OtherData();

        string xpath = "/building/" + building.ToString();

        XmlElement node = (XmlElement)xmlDocBuilding.SelectSingleNode(xpath);

        if (node == null)
        {
            Debug.Log("On OtherDescriptionReader GetBuildingData: " + building.ToString() + " not found");
            return(null);
        }

        data.description = node["description"].InnerXml;
        data.effect      = node["effect"].InnerXml;

        return(data);
    }
    public OtherData GetTerrainData(HexType terrain)
    {
        // TODO: parser here
        OtherData data = new OtherData();

        string xpath = "/terrain/" + terrain.ToString();

        XmlElement node = (XmlElement)xmlDocTerrain.SelectSingleNode(xpath);

        if (node == null)
        {
            Debug.Log("On OtherDescriptionReader GetTerrainData: " + terrain.ToString() + " not found");
            return(null);
        }

        data.description = node["description"].InnerXml;
        data.effect      = node["effect"].InnerXml;

        return(data);
    }
Example #21
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.layer == LayerMask.NameToLayer("Monsters"))
        {
            Monster enemy = collision.gameObject.GetComponent <Monster>();
            if (enemy == null)
            {
                //子物体为Monster的攻击碰撞体(例如:Monster的剑,组合怪且脚本只存在于主物体)
                enemy = collision.transform.parent.GetComponent <Monster>();
            }

            if (enemy != null)
            {
                OtherData data = new OtherData(enemy.Att);
                onceBeHitEvent.Invoke(data);
            }
            else
            {
                Debug.LogWarning("当前碰撞体未找到Monster脚本,无法获取Monster的攻击数值");
            }
        }
    }