Exemple #1
0
    private void SendMessage()
    {
        if (messageInput.text != string.Empty)
        { // first check to see if there is any message to send
          // for all RT-data we are sending, we use an instance of the RTData object //
          // this is a disposable object, so we wrap it in this using statement to make sure it is returned to the pool //
            using (RTData data = RTData.Get())
            {
                data.SetString(1, messageInput.text);                            // we add the message data to the RTPacket at key '1', so we know how to key it when the packet is receieved
                data.SetString(2, DateTime.Now.ToString());                      // we are also going to send the time at which the user sent this message

                UpdateChatLog("Me", messageInput.text, DateTime.Now.ToString()); // we will update the chat-log for the current user to display the message they just sent

                messageInput.text = string.Empty;                                // and we clear the message window

                DebugTool.Instance().SetMessage(new DebugMessage("Sending Message to All Players... \n" + messageInput.text, DebugMessageType.Error));

                // for this example we are sending RTData, but there are other methods for sending data we will look at later //
                // the first parameter we use is the op-code. This is used to index the type of data being send, and so we can identify to ourselves which packet this is when it is received //
                // the second parameter is the delivery intent. The intent we are using here is 'reliable', which means it will be send via TCP. This is because we aren't concerned about //
                // speed when it comes to these chat messages, but we very much want to make sure the whole packet is received //
                // the final parameter is the RTData object itself //
                GameSparksRTController.Instance().GetRtSession().SendData(1, GameSparks.RT.GameSparksRT.DeliveryIntent.RELIABLE, data);
            }
        }
        else
        {
            DebugTool.Instance().SetMessage(new DebugMessage("Not Chat Message To Send...", DebugMessageType.Error));
        }
    }
Exemple #2
0
            } // end NoviceVillage

            public void Initialize() {
                m_mainCanvas = new MainCanvas();
                m_mainAudio = new MainAudio();
                m_mainCamera = new MainCamera();
                ObjectTool.InstantiateGo("npc_transmitter", ResourcesTool.LoadPrefab("npc_transmitter"),
                    null, new UnityEngine.Vector3(0, 0, 10), new UnityEngine.Vector3(0, 270, 0), UnityEngine.Vector3.one).AddComponent<NPC_Transmitter2>();
                m_characterManager.factory.CreateMainCharacter(new UnityEngine.Vector3(0, 0, 0));
                m_characterManager.factory.CreateNPC("901001", new UnityEngine.Vector3(20, 0, 0));
                m_characterManager.factory.CreateNPC("902001", new UnityEngine.Vector3(20, 0, 10));
                m_characterManager.factory.CreateNPC("903001", new UnityEngine.Vector3(20, 0, 20));
                m_characterManager.factory.CreateNPC("904001", new UnityEngine.Vector3(10, 0, 20));
                m_characterManager.factory.CreateNPC("904002", new UnityEngine.Vector3(0, 0, 20));
                m_characterManager.factory.CreateNPC("904003", new UnityEngine.Vector3(-10, 0, 20));
                m_characterManager.factory.CreateNPC("904004", new UnityEngine.Vector3(-20, 0, 20));
                m_characterManager.factory.CreateNPC("904005", new UnityEngine.Vector3(-20, 0, 10));
                m_characterManager.factory.CreateNPC("904006", new UnityEngine.Vector3(-20, 0, 0));
                m_characterManager.factory.CreateNPC("904007", new UnityEngine.Vector3(-20, 0, -10));
                m_characterManager.factory.CreateNPC("904008", new UnityEngine.Vector3(-20, 0, -20));
                m_characterManager.factory.CreateNPC("904009", new UnityEngine.Vector3(-10, 0, -20));
                m_characterManager.factory.CreateNPC("904010", new UnityEngine.Vector3(0, 0, -20));
                m_characterManager.factory.CreateNPC("905001", new UnityEngine.Vector3(10, 0, -20));
                m_characterManager.factory.CreateNPC("905002", new UnityEngine.Vector3(20, 0, -20));
                m_characterManager.factory.CreateNPC("905003", new UnityEngine.Vector3(20, 0, -10));
                m_characterManager.factory.CreateNPC("906001", new UnityEngine.Vector3(30, 0, 0));
                m_characterManager.factory.CreateNPC("906002", new UnityEngine.Vector3(0, 0, 30));
                m_characterManager.factory.CreateNPC("906003", new UnityEngine.Vector3(-30, 0, 0));
                m_mainAudio.PlayBackgroundMusic("fight_scene_bgm");
                if (null == mainCharacter) {
                    DebugTool.LogError("NoviceVillage CreateMainCharacter is null!!");
                    return;
                } // end if
                m_mainCamera.SetTarget(mainCharacter);
                mainCharacter.fsm.PerformTransition("wait");
                uiPanelFSM.PerformTransition(new UIFightPanel());
            } // end Initialize
Exemple #3
0
                } // end ReloadWeapon

                private void ReloadWing(IEquipInfo info)
                {
                    if (null == info)
                    {
                        if (null != wingGo)
                        {
                            UnityEngine.Object.Destroy(wingGo);
                        }
                        // end if
                        return;
                    } // end if
                    string     id = info.id;
                    GameObject Go = ObjectTool.InstantiateGo(id, ResourcesTool.LoadPrefab(id));

                    if (null == Go)
                    {
                        DebugTool.LogError("ReloadWing ID: " + id + " prefab is don't exsit!");
                        return;
                    } // end if
                    if (null != wingGo)
                    {
                        UnityEngine.Object.Destroy(wingGo);
                    }
                    // end if
                    wingGo = Go;
                    wingGo.transform.SetParent(wingTrans);
                    wingGo.transform.localPosition = Vector3.zero;
                    wingGo.transform.localRotation = Quaternion.identity;
                } // end ReloadWing
Exemple #4
0
        public static async Task call_back_process_alldata(string msg, object obj)
        {
            DebugTool.Log("call back of all data------" + msg);
            CommonRet o = (CommonRet)getJsonObj(msg);

            if (o == null || o.flag == null)
            {
                return;
            }
            if (o.flag.Equals("1"))
            {
                Windows.Storage.ApplicationDataContainer settings = Windows.Storage.ApplicationData.Current.LocalSettings;

                ApplicationSettings.RemoveSetting(SettingKeys.CLIENT_DATA);
                ApplicationSettings.RemoveSetting(SettingKeys.EVENT_DATA);
                //ApplicationSettings.RemoveSetting(SettingKeys.ERROR_DATA);
                ApplicationSettings.RemoveSetting(SettingKeys.PAGE_INFO);
                ApplicationSettings.RemoveSetting(SettingKeys.HAS_DATA_TO_SEND);

                await ApplicationSettings.RemoveSettingFromXmlFileAsync(SettingKeys.CLIENT_DATA);

                await ApplicationSettings.RemoveSettingFromXmlFileAsync(SettingKeys.EVENT_DATA);

                //ApplicationSettings.RemoveSettingFromXmlFileAsync(SettingKeys.ERROR_DATA);
                await ApplicationSettings.RemoveSettingFromXmlFileAsync(SettingKeys.PAGE_INFO);

                //ApplicationSettings.RemoveSetting(SettingKeys.HAS_DATA_TO_SEND);

                CrashListener.RemoveErrorLog();

                DebugTool.Log("delete file success!");
            }
        }
Exemple #5
0
    //#############################################################
    //创建同屏角色
    bool newOtherPlayerHandler(object[] args)
    {
        var list = (List <PlayerData>)args [0];

        foreach (PlayerData newplayerData in list)
        {
            if (ClientAllPlayerDic.ContainsKey(newplayerData.userid) == false)
            {
                if (mine == null || newplayerData.userid == mine.userid)
                {
                    DebugTool.LogError("排除自己");
                    continue;                    //排除自己
                }

                newplayerData.go     = Instantiate(characterPrefab, this.transform);
                newplayerData.go.tag = "Untagged";
                newplayerData.go.transform.position = new Vector3(newplayerData.Pos.X * .0001f, 2f, newplayerData.Pos.Y * .0001f); //+= Vector3.left * Random.Range (0f, 1f);
                newplayerData.go.name   = newplayerData.userid.ToString();                                                         //"Player_" + newplayerData.nickname;
                newplayerData.isMine    = false;
                newplayerData.comp      = newplayerData.go.AddComponent <Player> ();
                newplayerData.comp.data = newplayerData;

//			newplayerData.comp.data.isMine = false;
                newplayerData.go.SetActive(true);
//			if (allPlayers.ContainsKey (newplayerData.userid)) {
//				DebugTool.LogError ("重复的其他玩家数据的添加,userid:" + newplayerData.userid);
//			}
                ClientAllPlayerDic.Add(newplayerData.userid, newplayerData);
//			allPlayers.Add (newplayerData);
            }
        }
        return(true);
    }
Exemple #6
0
 // Constructeur ---------------------------------------------------------------------------
 ///<summary>
 /// Initialisation d'un objet vide
 ///</summary>
 public TextFile()
 {
     // Clear current content
     _fileContents    = null;
     _currentFileName = null;
     _debugTool       = new DebugTool(DebugTool.EDebugToolType.Disabled);
 }
Exemple #7
0
        public static void call_back_process_configdata(string msg, object obj)
        {
            ConfigRet o = new ConfigRet();

            try
            {
                o = UmsJson.Deserialize <ConfigRet>(msg);
            }
            catch (Exception e)
            {
                DebugTool.Log(e);
            }
            if (o == null)
            {
                return;
            }
            if (o.flag.Equals("1"))
            {
                Windows.Storage.ApplicationDataContainer settings = Windows.Storage.ApplicationData.Current.LocalSettings;
                ApplicationSettings.SetSetting <string>(SettingKeys.UPDATE_ONLY_WIFI, o.updateonlywifi);
                ApplicationSettings.SetSetting <string>(SettingKeys.REPORT_POLICY, o.reportpolicy);
                ApplicationSettings.SetSetting <string>(SettingKeys.AUTO_LOCATION, o.autogetlocation);
            }

            DebugTool.Log("call back of onlineconfig data------" + msg);
        }
Exemple #8
0
                } // end Init

                private void InitAvatar(string roleType)
                {
                    string prefix = "";

                    switch (roleType)
                    {
                    case ConstConfig.SWORDMAN:
                        prefix = "swordman_";
                        break;

                    case ConstConfig.ARCHER:
                        prefix = "archer_";
                        break;

                    case ConstConfig.MAGICIAN:
                        prefix = "magician_";
                        break;

                    default:
                        DebugTool.LogError("DisplayRole roleType: " + roleType + "is not config!!");
                        return;
                    } // end switch
                    string[]  animPathArr = new string[] { "pose", "wait" };
                    Animation avatar      = displayGo.AddComponent <Animation>();

                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + animPathArr[0]), animPathArr[0]);
                    avatar.AddClip(ResourcesTool.LoadAnimationClip(prefix + animPathArr[1]), animPathArr[1]);
                    foreach (AnimationState state in avatar)
                    {
                        state.speed = 0.5f;
                    } // end foreach
                    avatar.Play(animPathArr[0]);
                    avatar.PlayQueued(animPathArr[1], QueueMode.CompleteOthers);
                } // end InitAvatar
Exemple #9
0
                public DisplayRole(string roleType)
                {
                    this.roleType = roleType;
                    Init(roleType);
                    string weaponID = "";

                    switch (roleType)
                    {
                    case ConstConfig.SWORDMAN:
                        weaponID = "100005";
                        break;

                    case ConstConfig.ARCHER:
                        weaponID = "100010";
                        break;

                    case ConstConfig.MAGICIAN:
                        weaponID = "100015";
                        break;

                    default:
                        DebugTool.LogError("DisplayRole roleType: " + roleType + "is not config!!");
                        return;
                    } // end switch
                    ReloadWing(Configs.itemConfig.GetItemInfo("106005") as IEquipInfo);
                    ReloadArmor(Configs.itemConfig.GetItemInfo("103005") as IEquipInfo);
                    ReloadWeapon(Configs.itemConfig.GetItemInfo(weaponID) as IEquipInfo);
                    InitAvatar(roleType);
                } // end DisplayRole
Exemple #10
0
                } // end ReloadEquip

                private void ReloadWeapon(IEquipInfo info)
                {
                    string id;

                    if (null == info)
                    {
                        id = roleType + "_weapon";
                    }
                    else
                    {
                        id = info.id;
                    }
                    // end if
                    GameObject Go = ObjectTool.InstantiateGo(id, ResourcesTool.LoadPrefab(id));

                    if (null == Go)
                    {
                        DebugTool.LogError("ReloadWeapon ID: " + id + " prefab is don't exsit!");
                        return;
                    } // end if
                    if (null != weaponGo)
                    {
                        Object.Destroy(weaponGo);
                    }
                    // end if
                    weaponGo = Go;
                    Go.transform.SetParent(liftTrans);
                    Go.transform.localScale    = Vector3.one;
                    Go.transform.localPosition = Vector3.zero;
                    Go.transform.localRotation = Quaternion.identity;
                    foreach (Transform child in Go.transform)
                    {
                        child.gameObject.layer = LayerConfig.IgnoreRaycast;
                    } // end foreach
                }     // end ReloadWeapon
Exemple #11
0
                }     // end ReloadWeapon

                private void ReloadWing(IEquipInfo info)
                {
                    if (null == info)
                    {
                        if (null != wingGo)
                        {
                            Object.Destroy(wingGo);
                        }
                        return;
                    } // end if
                    string     id = info.id;
                    GameObject Go = ObjectTool.InstantiateGo(id, ResourcesTool.LoadPrefab(id));

                    if (null == Go)
                    {
                        DebugTool.LogError("ReloadWing ID: " + id + " prefab is don't exsit!");
                        return;
                    } // end if
                    if (null != wingGo)
                    {
                        Object.Destroy(wingGo);
                    }
                    // end if
                    wingGo = Go;
                    Go.transform.SetParent(wingTrans);
                    Go.transform.localScale    = Vector3.one;
                    Go.transform.localPosition = Vector3.zero;
                    Go.transform.localRotation = Quaternion.identity;
                    Transform[] allChildren = Go.transform.GetComponentsInChildren <Transform>();
                    foreach (Transform child in allChildren)
                    {
                        child.gameObject.layer = LayerConfig.IgnoreRaycast;
                    } // end foreach
                }     // end ReloadWing
Exemple #12
0
                } // end InitSkillConfig
                #endregion

                public bool TryGetSkillInfo(string id, out ISkillInfo info) {
                    if (skillConfig.TryGetValue(id, out info)) return true;
                    // end if
                    info = null;
                    DebugTool.LogError("IconConfig TryGetSkillInfo ISkillInfo is null!!! ID:" + id);
                    return false;
                } // end TryGetSkillInfo
Exemple #13
0
                } // end UIFightPanel

                public void DoBeforeEntering() {
                    isShowBar = false;
                    gameObject = ObjectTool.InstantiateGo("UIFightPanel", ResourcesTool.LoadPrefabUI(id), 
                        SceneManager.mainCanvas.rectTransform);
                    rectTransform = gameObject.GetComponent<RectTransform>();
                    rectTransform.sizeDelta = SceneManager.mainCanvas.sizeDelta;
                    mainCharacterPanel = rectTransform.Find("MainCharacterInfoPanel").gameObject.AddComponent<UIMainCharacterInfoPanel>();
                    lockCharacterPanel = rectTransform.Find("LockCharacterInfoPanel").gameObject.AddComponent<UILockCharacterInfoPanel>();
                    lockCharacterPanel.gameObject.SetActive(false);
                    buffPanel = new UIBuffPanel(rectTransform.Find("BuffPanle") as RectTransform, new Vector2(35f, 35f));
                    avatar = rectTransform.Find("BarPanel").GetComponent<Animator>();
                    rectTransform.Find("BarPanel/BarBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(delegate () { OnClickBarBtn(); });
                    rectTransform.Find("BarPanel/BtnList/InfoBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(OnClickInfoBtn);
                    rectTransform.Find("BarPanel/BtnList/PackBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(OnClickPackBtn);
                    rectTransform.Find("BarPanel/BtnList/SettingBtn").gameObject.AddComponent<UIButtonNormal>().AddListener(OnClickSettingBtn);
                    rectTransform.Find("AttackBtn").gameObject.AddComponent<UIButton>().AddListener(OnClickAttackBtn);
                    skillPanel = new UISkillPanel(rectTransform);
                    GameObject joystickUI = ObjectTool.InstantiateGo("Joystick", ResourcesTool.LoadPrefabUI("joystick_ui"), rectTransform);
                    joystickUI.transform.Find("JoystickUI").gameObject.AddComponent<UIJoystick>();
                    joystickUI.GetComponent<RectTransform>().sizeDelta =  SceneManager.mainCanvas.sizeDelta;
                    if (null == SceneManager.mainCharacter) {
                        DebugTool.LogError(GetType() + "DoBeforeEntering SceneManager mainCharacter is null!");
                        return;
                    } // end if
                    string roleType = SceneManager.mainCharacter.info.characterData.roleType;
                    rectTransform.Find("AttackBtn").GetComponent<Image>().sprite = ResourcesTool.LoadSprite(roleType + "_attack");
                } // end DoBeforeEntering
    private static void ExportAllViewName()
    {
        string windowRegistPath = "Assets/Editor/LuaScript/Library/Window/WindowRegist.lua";

        if (!File.Exists(windowRegistPath))
        {
            DebugTool.LogError(string.Format("不存在路径\t{0}", windowRegistPath));
            return;
        }
        string exportPath = EditorUtility.OpenFolderPanel("导出目录", "", "");

        if (string.Empty == exportPath || null == exportPath)
        {
            return;
        }
        exportPath = string.Format(@"{0}/界面中英文名对照.csv", exportPath);
        FileStream   file             = new FileStream(exportPath, FileMode.Create);
        StreamWriter fileWriter       = new StreamWriter(file);
        string       windowRegistText = File.ReadAllText(windowRegistPath);

        fileWriter.Write(FilterWindowRegist(windowRegistText));
        fileWriter.Close();
        fileWriter.Dispose();
        if (File.Exists(exportPath))
        {
            DebugTool.Log("导出成功");
        }
    }
 /// <summary>
 /// 所有的资源的导入,删除,移动,都会调用此方法,注意,这个方法是static的
 /// </summary>
 public static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
 {
     DebugTool.Log("OnPostprocessAllAssets");
     foreach (string str in importedAssets)
     {
         if (str.EndsWith("cs"))
         {
             continue;
         }
         DebugTool.Log("importedAsset = " + str);
     }
     foreach (string str in deletedAssets)
     {
         DebugTool.Log("deletedAssets = " + str);
     }
     foreach (string str in movedAssets)
     {
         if (str.EndsWith("cs"))
         {
             continue;
         }
         DebugTool.Log("movedAssets = " + str);
     }
     foreach (string str in movedFromAssetPaths)
     {
         DebugTool.Log("movedFromAssetPaths = " + str);
     }
     AssetTextureImporter.OnPostprocessAllAssets();
     AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
 }
    public override float Damage(ModelAttackData data)
    {
        float percent = base.Damage(data);

        DebugTool.Log("ModelPlayer::Damage " + m_healthPoint.ToString());
        return(percent);
    }
Exemple #17
0
    //new player for me
    public static void sendCreateSelf()
    {
        // ====== 走pb 发送 ====== or 直接发送 =====
#if PROTOBUFF
        Rqst_CreateSelf data = new Rqst_CreateSelf();
        data.Account  = "" + 1000 + UnityEngine.Random.Range(1, 100);
        data.Password = "" + 123456;
        DebugTool.LogYellow("[TCP] sendCreateSelf 请求创建我方角色" + data.Account);
        connect_TCP.Send <Rqst_CreateSelf> ((short)NetCode.CreateSelf, data);
        GameProxy.mine        = new PlayerData();
        GameProxy.mine.userid = data.Account;
#else
        DebugTool.LogError("已经不许使用自写编码,请检察 UnityEngine里是否添加宏: PROTOBUFF");
        //===== 直接发送  自写的编码,无法对付可变长byte[]======
        SendBuffer.ResetIndex();
        SendBuffer.writeUshort(10000);         //cmd,  payload as below
        var r = UnityEngine.Random.Range(1, 100);
        SendBuffer.writeInt(9999 + r);         //accountid
//		SendBuffer.writeString ("gaohebing" + UnityEngine.Random.Range (0, 100));//nickname
//		SendBuffer.writeInt (1);//level
        SendBuffer.writeInt(123);         //password

        var    arr      = SendBuffer.GetBytes_HasData();
        byte[] sendbuff = new byte[arr.Length];
        Array.Copy(arr, sendbuff, sendbuff.Length);

        connect_TCP.SendBytes(sendbuff);
#endif
    }
Exemple #18
0
                } // end Freshen

                private void ReloadWeapon(IEquipInfo info)
                {
                    string id;

                    if (null == info)
                    {
                        id = GameManager.playerInfo.roletype + "_weapon";
                    }
                    else
                    {
                        id = info.id;
                    }
                    // end if
                    GameObject Go = ObjectTool.InstantiateGo(id, ResourcesTool.LoadPrefab(id));

                    if (null == Go)
                    {
                        DebugTool.LogError("ReloadWeapon ID: " + id + " prefab is don't exsit!");
                        return;
                    } // end if
                    if (null != weaponGo)
                    {
                        UnityEngine.Object.Destroy(weaponGo);
                    }
                    // end if
                    weaponGo = Go;
                    FurlWeapon();
                } // end ReloadWeapon
Exemple #19
0
    static IEnumerator upLoadFiles(string url, List <string> fileds, List <byte[]> bytes, List <string> files, List <string> otherDataKeys, List <string> otherDataValues, Action <string> CallBack)
    {
        WWWForm wwwForm = new WWWForm();

        for (int i = 0; i < bytes.Count; i++)
        {
            wwwForm.AddBinaryData(fileds[i], bytes[i], files[i]);
        }
        var otherDataUrl = "";

        for (int i = 0; i < otherDataKeys.Count; i++)
        {
            otherDataUrl += "?" + otherDataKeys[i] + "=" + otherDataValues[i];
        }
        WWW www = new WWW(url, wwwForm);

        yield return(www);

        if (string.IsNullOrEmpty(www.error))
        {
            DebugTool.LogError("UpLoadFiles Error:" + www.error);
        }
        else
        {
            if (CallBack != null)
            {
                CallBack(www.text);
            }
        }
    }
Exemple #20
0
        public static void call_back_process_updatedata(string msg, object obj)
        {
            UpdateRet o = new UpdateRet();

            try
            {
                o = UmsJson.Deserialize <UpdateRet>(msg);
            }
            catch (Exception e)
            {
                DebugTool.Log(e);
            }
            if (o == null)
            {
                return;
            }


            if (o.flag.Equals("1"))
            {
                showUpdateDialog(o.time, o.version, o.description, o.fileurl);
            }

            DebugTool.Log("call back of check version------" + msg);
        }
 public static void printBytes()
 {
     for (int i = 0; i < GetMsgSize(); i++)               //sendBuf.Length; i++)
     {
         DebugTool.LogCyan("index:" + i + "/" + sendBuf [i].ToString("x2") + " / " + sendBuf [i].ToString());
     }
 }
Exemple #22
0
 public void Socket_Create_Connection()         //, Action onConnected, Action onConnectFail)
 {
     queue_LogError.Enqueue("Socket_Create_Connection func");
     //--------------------------------------
     if ((m_Socket != null && m_Socket.Connected == true))
     {
         Close(m_Socket);
         return;
     }
     m_Socket = null;
     timeOutObject.Reset();             //复位timeout事件
     m_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     queue_LogError.Enqueue("a ------------- Socket_Create_Connection");
     try {
         #region 异步连接
         connect_TCP = m_Socket.BeginConnect(_ipe, AsyncConnectCallbac, m_Socket);
     } catch (Exception e) {
         queue_LogError.Enqueue("b Error-------------Create Socket ::  BeginConnect::" + e.Message);
     }
     if (timeOutObject.WaitOne(timeoutLen))
     {
         DebugTool.LogYellow("连接成功 :) ");
     }
     else
     {
         DebugTool.LogYellow("连接失败 :( ");
     }
     #endregion
 }
Exemple #23
0
        /** 更新。
         */
        public void Main()
        {
            while (true)
            {
                int t_count = this.list.Count;
                if (t_count > 0)
                {
                    WorkPool_Item t_current_work = this.list[t_count - 1];
                    this.list.RemoveAt(t_count - 1);
                    if (this.Main_Item(t_current_work) == false)
                    {
                        //エラー。
                        this.list.Clear();

                                                #if (DEF_BLUEBACK_JSONITEM_ASSERT)
                        DebugTool.Assert(false);
                                                #endif
                    }

                    //たぶん無限ループ。
                    if (t_count > Config.POOL_MAX)
                    {
                        this.list.Clear();

                                                #if (DEF_BLUEBACK_JSONITEM_ASSERT)
                        DebugTool.Assert(false);
                                                #endif
                    }
                }
                else
                {
                    break;
                }
            }
        }
Exemple #24
0
        // Public ---------------------------------------------------------------------------------
        public Strategy(String strategyName)
        {
            // Si le nom est non nul, on ajoute ce nom à la stratégie
            if (strategyName != null)
            {
                _strategyName = strategyName;
            }

            // Creation du premier objet pour la partie décisionnelle
            _subStrategies = new List <SubStrategy>();
            _subStrategies.Add(new SubStrategy(PrivateConst.mainStrategyName, 0));

            // Creation de la position du robot initial
            _initialPos         = new RobotAction(0);
            _initialPos.cmdType = EnumCmdType.CmdType_Blocking;             // Blocking Action
            _initialPos.cmd     = EnumCmd.App_SetNewPos;                    // Defines the first robot position
            _initialPos.param2  = "1500";                                   // X
            _initialPos.param3  = "1000";                                   // Y
            _initialPos.param4  = "0";                                      // Angle
            _initialPos.activeSensors.DesactivateAllSensors();              // Do not use bumpers

            // Creation de la vitesse par défaut
            _defaultSpeed      = 50;
            _defaultPivotSpeed = 50;

            _debugTool = new DebugTool(DebugTool.EDebugToolType.Console);
        }
Exemple #25
0
    private static void AddNumberToGroup(Transform group, int damage, NumberColor color)
    {
        if (!dicNumber.ContainsKey(color))
        {
            DebugTool.LogError("UINumberManager not exit color image, color\t" + color.ToString());
            return;
        }
        bool isHaveSub = dicSprite.ContainsKey(color) && dicSprite[color].ContainsKey(-1);
        int  length    = CalculateDamageLength(damage);

        if (isHaveSub)
        {
            length++;
        }
        Transform[] arrayNumImages = new Transform[length];
        if (isHaveSub)
        {
            AddSubToList(color, (Transform sub) => {
                arrayNumImages[0] = sub;
                LoadCompletedCallBack(color, arrayNumImages, group);
            });
        }
        AddNumberToList(damage, color, (Transform numberImage, int index) => {
            arrayNumImages[index] = numberImage;
            LoadCompletedCallBack(color, arrayNumImages, group);
        }, length - 1);
    }
Exemple #26
0
                } // end GetItemGradeWithID

                public string GetItemType(string id)
                {
                    if (null == id)
                    {
                        DebugTool.LogError("ItemConfig GetItemType id is null!!!");
                        return("null");
                    } // end if
                    if (id.Length < 2)
                    {
                        ConsoleTool.SetWarning("ItemConfig GetItemType ID:" + id);
                        return("null");
                    } // end if
                    string prefix = id.Substring(0, 2);

                    switch (prefix)
                    {
                    default:
                        DebugTool.LogError("ItemConfig GetItemType id error!!!" + " ID:" + id);
                        return("null");

                    case "10": return(ConstConfig.EQUIP);

                    case "20": return(ConstConfig.CONSUME);

                    case "30": return(ConstConfig.STUFF);

                    case "40": return(ConstConfig.PRINT);
                    } // end switch
                }     // end GetItemTypeWithID
Exemple #27
0
        /** Convert
         */
        public static void Convert(string a_in_jsonstring, out bool a_out_value)
        {
            if (a_in_jsonstring.Length < 1)
            {
                //不明。

                                #if (DEF_BLUEBACK_JSONITEM_ASSERT)
                DebugTool.Assert(false);
                                #endif

                a_out_value = default;
                return;
            }

                        #pragma warning disable 0162
            switch (a_in_jsonstring[0])
            {
            case 't':
            case 'T':
            {
                a_out_value = true;
                return;
            } break;

            default:
            {
                a_out_value = false;
                return;
            } break;
            }
                        #pragma warning restore
        }
Exemple #28
0
        /** Convert
         */
        public static string Convert(string a_jsonstring)
        {
            System.Text.StringBuilder t_stringbuilder = new System.Text.StringBuilder(a_jsonstring.Length);

            int t_index = 0;

            while (t_index < a_jsonstring.Length)
            {
                //スペース改行タブのスキップ。
                if ((a_jsonstring[t_index] == ' ') || (a_jsonstring[t_index] == '\r') || (a_jsonstring[t_index] == '\t') || (a_jsonstring[t_index] == '\n'))
                {
                    t_index++;
                    while (t_index < a_jsonstring.Length)
                    {
                        if ((a_jsonstring[t_index] == ' ') || (a_jsonstring[t_index] == '\r') || (a_jsonstring[t_index] == '\t') || (a_jsonstring[t_index] == '\n'))
                        {
                            t_index++;
                        }
                        else
                        {
                            break;
                        }
                    }
                    continue;
                }

                switch (a_jsonstring[t_index])
                {
                case '\"':
                case '\'':
                {
                    int t_length = JsonStringLength.StringData.GetLength(a_jsonstring, t_index, a_jsonstring.Length);
                    if (t_length > 0)
                    {
                        t_stringbuilder.Append(a_jsonstring.Substring(t_index, t_length));
                        t_index += t_length;
                    }
                    else
                    {
                        //サイズの取得に失敗。

                                                        #if (DEF_BLUEBACK_JSONITEM_ASSERT)
                        DebugTool.Assert(false);
                                                        #endif

                        return("");
                    }
                } break;

                default:
                {
                    t_stringbuilder.Append(a_jsonstring[t_index]);
                    t_index++;
                } break;
                }
            }

            return(t_stringbuilder.ToString());
        }
 protected string GetAnimationName() {
     string animationName = m_role.GetAnimationName(GetState().ToString());
     if (animationName == string.Empty)
         animationName = GetAnimationName(GetState());
     if (animationName == string.Empty)
         DebugTool.Log(m_role.gameObject.name + " node not exit animation " + animationName);
     return animationName;
 }
Exemple #30
0
 public ModelMonsterData GetMonsterData(MonsterType type)
 {
     if (!m_dicMonsterData.ContainsKey(type))
     {
         DebugTool.LogError(string.Format("MMonsterData::GetAttackRoleData not exit type \"{0}\" data", type.ToString()));
     }
     return(m_dicMonsterData[type]);
 }